Second prototype of an anonymous and named function-Collection of common programming errors
Why would b.prototype.prototype
be defined?
var a = function () {};
a.prototype; // {}
function b () {}
b.prototype; // {}
Neither prototype has a property called prototype…
As such, asking for a nonextant property of an object results in undefined
.
The fact that the console is calling b.prototype
"b{}"
doesn’t change anything. It’s just saying that it’s the prototype object of the named-funciton b
, rather than an anonymous function, like the one assigned to a
.
It’s still an empty object, without a prototype.
Originally posted 2013-11-09 23:11:03.