Unspecified Error.call

Jussi Kalliokoski jussi.kalliokoski at gmail.com
Tue Jul 24 08:40:41 PDT 2012


I would expect that since Error works without `new`, it would disregard
`this`, hence that call would just return a new Error, so:

Error.call(o, 'ya') instanceof Error // true

Cheers,
Jussi

On Tue, Jul 24, 2012 at 6:30 PM, David Bruant <bruant.d at gmail.com> wrote:

> Hi,
>
> I've recently discovered that the following code seems to have an
> undefined behavior in ES5.1
> ====
> var o = {};
> Error.call(o, 'ya'); // what is the "Error" function supposed to do with
> 'this', who knows?
> console.log(o.message) // undefined in latest Firefox, Chrome and Opera
> ====
>
> The result seems consistent across browsers I could test with. Maybe I'm
> misreading the spec?
>
> David
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120724/b707d6c9/attachment.html>


More information about the es-discuss mailing list