| 1 |
// Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es5id: 15.2.3.14-5-13 |
| 6 |
description: > |
| 7 |
Object.keys - own enumerable indexed data property of sparse array |
| 8 |
'O' is defined in returned array |
| 9 |
---*/ |
| 10 |
|
| 11 |
var obj = [1, , 3, , 5]; |
| 12 |
|
| 13 |
Object.defineProperty(obj, 5, { |
| 14 |
value: 7, |
| 15 |
enumerable: false, |
| 16 |
configurable: true |
| 17 |
}); |
| 18 |
|
| 19 |
Object.defineProperty(obj, 10000, { |
| 20 |
value: "ElementWithLargeIndex", |
| 21 |
enumerable: true, |
| 22 |
configurable: true |
| 23 |
}); |
| 24 |
|
| 25 |
var arr = Object.keys(obj); |
| 26 |
|
| 27 |
var index; |
| 28 |
var initValue = 0; |
| 29 |
for (index = 0; index < 3; index++) { |
| 30 |
assert.sameValue(arr[index], initValue.toString(), 'Unexpected property at index: ' + index); |
| 31 |
initValue += 2; |
| 32 |
} |
| 33 |
|
| 34 |
assert.sameValue(arr.length, 4, 'arr.length'); |
| 35 |
assert.sameValue(arr[3], "10000", 'arr[3]'); |