Object Instances
This lesson teaches us how to create object instances using constructor functions by explaining the syntax and giving an example.
We'll cover the following...
Let’s discuss how to create objects using the constructor function.
Press + to interact
function Employee(_name, _age, _designation){this.name = _namethis.age = _agethis.designation = _designation}
Creating an Object Instance
Every time a new object is created, it is referred to as a new instance. Multiple object instances can be generated using constructor functions.
Syntax
Let’s take a look at the syntax for creating an object:
Press + to interact
var ObjectName = new ConstructorFunction(argument1, argument2,....)
Explanation
-
The keyword
new
is used to create a new object. -
That is followed by the constructor function being ...
Access this course and 1400+ top-rated courses and projects.