2.1.76 [ECMA-262-1999] Section 15.4.5.1, [[Put]] (P, V)

V0121:

Array objects use a variation of the [[Put]] method used for other native ECMAScript objects ([ECMA-262-1999] section 8.6.2.2).

Assume A is an Array object and P is a string.

When the [[Put]] method of A is called with property P and value V, the following steps are taken:

(The bulleted step is added before step 1)

  • __If JScript 5.7 and P is "length", go to step 12.__

1. Call the [[CanPut]] method of A with name P.

2. If Result(1) is false, return.

3. If A doesn't have a property with name P, go to step 7.

4. If P is "length", go to step 12.

5. Set the value of property P of A to V.

6. Go to step 8.

7. Create a property with name P, set its value to V and give it empty attributes.

8. If P is not an array index __and not '4294967295'__, return.

  1. __If P is '4294967295', go to step 17.__

9. If ToUint32(P) is less than the value of the length property of A, then return.

10. Change (or set) the value of the length property of A to ToUint32(P)+1.

11. Return.

12. Compute ToUint32(V).

  1. __If 0 ≤ ToNumber(V) < 4294967296, go to step 14.__

13. If Result(12) is not equal to ToNumber(V), throw a RangeError exception.

14. For every integer k that is less than the value of the length property of A but not less than Result(12), if A itself has a property (not an inherited property) named ToString(k), then delete that property.

15. Set the value of property P of A to Result(12).

16. Return.

17. __For every integer k that is less than the value of the length property of A but not less than 0, if A itself has a property (not an inherited property) named ToString(k), then delete that property.__

18. __Change (or set) the value of the length property of A to 0.__

19. __Return.__

V0122:

JScript 5.x does not throw a RangeError if an attempt is made to set the length property of an array object to a positive, non-integer value less than 232. If the property named '4294967295' of an array object is set, the length property of the array is set to 0 and any existing array index named properties are deleted if their names are array indices smaller than the former value of the length property.