0
Prototype asign value to property from an object
I'm learning about prototype I tried change the value of name property from object person1 with set method in object person2 but why when i call person1.name the value is still doesn't change at all ? Please explain me why this is happened, thanks in advance!! . https://code.sololearn.com/WSCVHuuo29BM/?ref=app
1 ответ
+ 1
person2.__proto__ = person1;
console.log(person2.getName);
person2.getName = "bambang";
console.log(person2.getName);
console.log(person1.name)
Also take a look at this ,the following property is deprecated and is not encouraged to use in real code
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/proto