Object.getPrototypeOf(arguments) VS [[Class]]

Brendan Eich brendan at mozilla.org
Wed Nov 28 08:59:53 PST 2012


ES1-3 had arguments pretending to be "Object" but not actually an Object 
instance.

ES5 changed to use an internal class with name "Arguments". No Arguments 
constructor, Arguments.prototype, etc.

I don't think we should polish the arguments turd further.

/be

Andrea Giammarchi wrote:
> I just wonder if anyone can explain why functions arguments [[Class]] 
> is Arguments but Object.getPrototypeOf(arguments) is Object.prototype
>
> This looks to me inconsistent against every other [[Class]] different 
> from Object case:either the class Arguments exists, or it doesn't, 
> don't you think?
>
> !function(){
> Object.getPrototypeOf(arguments) == Object.prototype; // true
> {}.toString.call(
>   Object.getPrototypeOf(arguments)
> ) == {}.toString(); // true again
> }();
>
> Thanks for clarifications.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list