Debian Codegraph @

js/src/tests/test262/built-ins/Array/length/S15.4.5.1_A1.2_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 esid: sec-array-exotic-objects-defineownproperty-p-desc
6 info: |
7 For every integer k that is less than the value of
8 the length property of A but not less than ToUint32(length),
9 if A itself has a property (not an inherited property) named ToString(k),
10 then delete that property
11 es5id: 15.4.5.1_A1.2_T1
12 description: Change length of array
13 ---*/
14
15 var x = [0, , 2, , 4];
16 x.length = 4;
17 assert.sameValue(x[4], undefined, 'The value of x[4] is expected to equal undefined');
18
19 x.length = 3;
20 assert.sameValue(x[3], undefined, 'The value of x[3] is expected to equal undefined');
21 assert.sameValue(x[2], 2, 'The value of x[2] is expected to be 2');
22
23 reportCompare(0, 0);