call and apply
raul.mihaila at gmail.com
Fri May 3 05:33:05 PDT 2013
In section 188.8.131.52 Function.prototype.apply (thisArg, argArray) (page 119
of Ecma-262, Edition 5.1) there's this note:
'The thisArg value is passed without modification as the this value. This
is a change from Edition 3, where a undefined or null thisArg is replaced
with the global object and ToObject is applied to all other values and that
result is passed as the this value.' From this I understand that this is
happening in both non-strict mode and strict mode.
But in Annex C, one of the bullets says (page 235):
'If this is evaluated within strict mode code, then the this value is not
coerced to an object. A this value of null or undefined is not converted to
the global object and primitive values are not converted to wrapper
objects. The this value passed via a function call (including calls made
using Function.prototype.apply and Function.prototype.call) do not coerce
the passed this value to an object (10.4.3, 11.1.1, 184.108.40.206, 220.127.116.11).'
>From this I understand that the coercion occurs only in non-strict mode
(like in Firefox).
Is it possible to make this clearer in the next edition, please?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss