Debian Codegraph @

js/src/tests/test262/built-ins/Array/S15.4.5.2_A2_T1.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 If a property is added whose name is an array index,
7 the length property is changed
8 es5id: 15.4.5.2_A2_T1
9 description: Checking length property
10 ---*/
11
12 var x = [];
13 assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
14
15 x[0] = 1;
16 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
17
18 x[1] = 1;
19 assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
20
21 x[9] = 1;
22 assert.sameValue(x.length, 10, 'The value of x.length is expected to be 10');
23
24 reportCompare(0, 0);