Working with Templates of an Object:
JavaScript language is based on objects. In JavaScript, you can create an object in two ways either by creating a direct instance or by creating an object using a function template. A direct instance of an object is created by using the new keyword.
Syntax for creating a new object:
You can also add properties and methods to an object by using a period (.) followed by or a method name.
Syntax to set properties or call a method:
Here name and rollnumber are properties and getValue is a method.
Demo: