The example code shows how to use the 'this' keyword to reference an object and the 'new'
Fantastic news! We've Found the answer you've been seeking!
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 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');
Related Book For
Dynamic Business Law
ISBN: 9781260733976
6th Edition
Authors: Nancy Kubasek, M. Neil Browne, Daniel Herron, Lucien Dhooge, Linda Barkacs
Posted Date: