| 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-6-5 |
| 6 |
description: > |
| 7 |
Object.keys - the order of elements in returned array is the same |
| 8 |
with the order of properties in 'O' (any other built-in object) |
| 9 |
---*/ |
| 10 |
|
| 11 |
var obj = new Date(); |
| 12 |
obj.prop1 = 100; |
| 13 |
obj.prop2 = "prop2"; |
| 14 |
|
| 15 |
var tempArray = []; |
| 16 |
for (var p in obj) { |
| 17 |
if (obj.hasOwnProperty(p)) { |
| 18 |
tempArray.push(p); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
var returnedArray = Object.keys(obj); |
| 23 |
|
| 24 |
for (var index in returnedArray) { |
| 25 |
assert.sameValue(tempArray[index], returnedArray[index], 'tempArray[index]'); |
| 26 |
} |