3 ms·
Normally it could be effectively optimised away and just treated as an extra argument. But it's also required by the spec that `foo().method !== foo().method`
by BillinghamJ 8y ago
Normally it could be effectively optimised away and just treated as an extra argument.
But it's also required by the spec that `foo().method !== foo().method` when returning new functions from a closure in `foo`, so the function has to be wrapped and a new structure allocated each time to differentiate.
- Roboprog 8y agoThanks. I suspect the internals of “===“ in this case could look for the presence of a closure data pointer on a Function or some such hack. Anyway, I’d probably use an actual prototype on something (with “methods” and) hundreds of instances, but otherwise, I’m not too worried about just using closures and object literals.