3 ms·
> Now, if you could override Function.prototype to just function(){} Function.prototype is already set to an empty function by default (evaluate Function.proto
by shawnz 13y ago
> Now, if you could override Function.prototype to just function(){}
Function.prototype is already set to an empty function by default (evaluate Function.prototype() and you get 'undefined'), so I am not sure this has the consequences you think it does.
When you call a function object, let's say f, Javascript looks for an internal method on f called [[Call]] and calls it. If one doesn't exist, an error is thrown. The internal property [[Prototype]] of f is not ever considered, although you are right that it would be equal to Function.prototype.
EDIT: Despite what I think, executing phpnode's code in my node.js REPL instantly crashes it, so I guess there is more going on here.
- oso2k 13y agoNode.js modifies globals is the issue and does other seriously interesting things[1]. [1] https://groups.google.com/forum/#!topic/nodejs/FuOB3151rPQ https://groups.google.com/forum/#!topic/nodejs/FuOB3151rPQ