P. 1
Standard ECMA 262

Standard ECMA 262

|Views: 28|Likes:
Publicado porDelfi Ramirez

More info:

Published by: Delfi Ramirez on Feb 13, 2010
Direitos Autorais:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/24/2012

pdf

text

original

When Array is called as part of a new expression, it is a constructor: it initialises the newly created
object.

15.4.2.1 new Array ( [ item0 [ , item1 [ , … ] ] ] )

This description applies if and only if the Array constructor is given no arguments or at least two
arguments.

The [[Prototype]] property of the newly constructed object is set to the original Array prototype
object, the one that is the initial value of Array.prototype (15.4.3.1).

The [[Class]] property of the newly constructed object is set to "Array".

The length property of the newly constructed object is set to the number of arguments.

The 0 property of the newly constructed object is set to item0 (if supplied); the 1 property of the
newly constructed object is set to item1 (if supplied); and, in general, for as many arguments as there
are, the k property of the newly constructed object is set to argument k, where the first argument is
considered to be argument number 0.

- 89 -

15.4.2.2 new Array (len)

The [[Prototype]] property of the newly constructed object is set to the original Array prototype
object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of
the newly constructed object is set to "Array".

If the argument len is a Number and ToUint32(len) is equal to len, then the length property of the
newly constructed object is set to ToUint32(len). If the argument len is a Number and ToUint32(len)
is not equal to len, a RangeError exception is thrown.

If the argument len is not a Number, then the length property of the newly constructed object is set
to 1 and the 0 property of the newly constructed object is set to len.

You're Reading a Free Preview

Descarregar
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->