Object Instances

This lesson teaches how to create object instances using constructor functions by explaining the syntax and giving an example.

In the previous lesson, we learned how to create a constructor function and how all the objects created using this will contain the properties defined inside the constructor. Now let’s discuss how to create objects using the constructor function.

Press + to interact
function Employee(_name, _age, _designation){
this.name = _name
this.age = _age
this.designation = _designation
}

Creating an Object Instance #

Every time a new object is created, it is referred to as a new instance. As discussed before, multiple object instances can be generated using constructor functions.

Syntax #

Let’s take ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy