When we define these variables in the console:
var a = function(){} ; var b = {} ; var c = new a();
and enter the following expressions again on the console:
a.prototype // we have an a object with properties constructor and __proto__ b.prototype // no result and why ? Isn t the prototype the Object c.prototype // no result here too.
Therefore, I know that almost every type in js is an object and has a prototype of a global object. Why do not we see the last two properties of the prototype? Is it about property descriptors or what? I just assume he has a simple answer.
A property with a name .prototypeis a property of a constructor function only. It is stored elsewhere for the actual instance of the object and is not available as .prototypeit is.
.prototype
Object.getPrototypeOf(obj) . . MDN.
Object.getPrototypeOf(obj)
obj.__proto__.
obj.__proto__
. , , . Javascript , . , , , , - , .
, . - . , .
++ ( , - ), , . , .
, , JavaScript . , , prototype.
prototype
? , . , , . ECMAScript, [[Prototype]] .
__proto__, [[Prototype]], , .
__proto__
ES6 : Object.getPrototypeOf().
Object.getPrototypeOf()
, instanceof. __proto__ prototype.
instanceof
Source: https://habr.com/ru/post/1620703/More articles:Do not receive BLE notifications in Android - javaCallback at notifyiteminserted / notifyitemremoved / notifyitemmoved - androidMap of bucket key values? - c ++GetAddrInfo C # hosts do not have such a host - c #Разница между оценкой while (n> 0) и while (n!= 0) - algorithmIs it possible to check if a pixel is in a line generated by bresenham without generating a line? - geometryHow to execute asynchronous requests on rails? - asynchronousPython class serializable variables - pythonGet fragment in layout - javaEbay Scheduled Time Mismatch Schedule - c #All Articles