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);

3rd Sep 2018, 12:02 AM
Miguel Angel Acosta
Miguel Angel Acosta - avatar
2 Answers
+ 3
You cannot delete a variable that declared with var Try delete Employee.company
3rd Sep 2018, 1:01 AM
CalviŐČ
CalviŐČ - avatar
+ 1
emp1 is still an Employee obj and Employee obj has the company value set to 'xyz' if no other value is present.
3rd Sep 2018, 12:13 AM
JME