2 plus ones
Shared publicly•View activity
- Where is my million dollar? :DDec 7, 2016
- You're invoking the prototype method without passing any arguments/parameters. It's undefined.Dec 7, 2016
Function.prototype is defined by spec to be a function. takes any number of args, returns undefined.
others, e.g. Object.prototype, Array.prototype, are not functions.Dec 7, 2016
- I'm not sure I understand the purpose of your reply, other than to provide additional information for those that don't understand, but it was addressed to me. My comment is valid, supported by your explanation. Method = Function.Dec 7, 2016
- To expand further, it's undefined because you're not calling one of its methods, such as function.prototype.toString(). It is designed to be undefined when not used properly, which is what your example in the OP represented.Dec 7, 2016
- Xah Lee+1yes methods are functions, but in general the value of property key "prototype" are not function themselves. (their properties are often functions)
e.g. Array.prototype is not a function. Calling Array.prototype() is an type error. But Array.prototype.shift is a function.
but the Function.prototype is a special case. It is a function, by spec. However, doesn't do anything useful. e.g.
all returns undefined.
did you know?
i didn't know till yesterday.Dec 7, 2016
- Syntax+1I did, and that's what I explained in less detail before your reply here.Dec 7, 2016
Add a comment...