I have this code:
var Person = {
"name": "",
"changes": {
"name to": function(value) {
this["name"] = value;
}
}
}
var Josh = Object.create(Person);
Josh["changes"]["name to"]("John");
console.log(Josh.name); // nothing
console.log(Josh.changes.name); // "John"
The problem is that this above refers to Object "changes" and not object instance "Josh".
I can't replace this with Person because then it's referring to the object "Person" and not to the object instance "Josh".
Is it possible to refer to Josh's name?