blob: 1dd461cabd42c34d2c79b4429abc7724ae856417 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright (c) 2012 Ecma International. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5es5id: 15.2.3.14-5-13
6description: >
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
34assert.sameValue(arr.length, 4, 'arr.length');
35assert.sameValue(arr[3], "10000", 'arr[3]');