I am new to using object.create instead of the classic js method to get prototypal inheritance.
In Chrome, at least I was surprised to see the following code:
var baseObject = {
test : function(){
console.log('Child');
}
}
var newObject = Object.create(baseObject);
newObject.test = function(){
console.log('Parent');
this.__proto__.test();
}
console.log(newObject);
newObject.test();
Produces this (simulates output in web tools):
Object {test: function, test: function}
test: function (){
__proto__: Object
test: function (){
__proto__: Object
Parent
Child
So you see that this is not a prototype installation, but instead only "__proto__", which I thought was discouraged in its use. You can see that in my code I can correctly inherit and call the parent object, but only using "__proto__". Using "prototype" results in an error (undefined).
? , object.create "prototype" , ( ). "__proto __"