Reputation:
In Chrome's JavaScript console:
function placeOrder() {
return 1;
};
undefined
console.log(placeOrder.prototype);
placeOrder {}
But In IE 11, the default prototype property seems to be an empty object. I wonder what is the object "placeOrder { }" in Chrome? I also tested it in Firefox. In Firefox, the prototype property is "placeOrder { }" too.
In IE 11 console:
function placeOrder() {
return 1;
};
undefined
console.log(placeOrder.prototype);
undefined
[object Object]{}
Thanks.
Upvotes: 1
Views: 400
Reputation: 288250
It's an object which inherits from Object.prototype
and has an own constructor
property whose value is the constructor function.
- Let proto be the result of creating a new object as would be constructed by the expression
new Object()
whereObject
is the standard built-in constructor with that name.- Call the [[DefineOwnProperty]] internal method of proto with arguments
"constructor"
, Property Descriptor {[[Value]]: F, { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}, and false.- Call the [[DefineOwnProperty]] internal method of F with arguments
"prototype"
, Property Descriptor {[[Value]]: proto, { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}, and false.
Upvotes: 3