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
Get step-by-step solutions from verified subject matter experts
