0
why the output of this code is: 'xyz'?
var Employee = { company: âxyzâ } var emp1 = Object.create(Employee); delete emp1.company console.log(emp1.company);
2 Answers
+ 3
You cannot delete a variable that declared with var
Try
delete Employee.company
+ 1
emp1 is still an Employee obj and Employee obj has the company value set to 'xyz' if no other value is present.