Question: The example code shows how to use the 'this' keyword to reference an object and the 'new' operator to instantiate a new object. Why do


The example code shows how to use the 'this' keyword to reference an object and the 'new' operator to instantiate a new object.

Why do we use 'this' in this case? Why not employee.name or employee.id?


class Employee {  constructor(name, id) {  this.name = name;  this.id = id;  }  }    var david_situ = new Employee('David Situ', '123456');

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!