| 1 |
// Copyright (C) 2015 Jordan Harband. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
esid: sec-object.entries |
| 6 |
description: Object.entries accepts string primitives. |
| 7 |
author: Jordan Harband |
| 8 |
---*/ |
| 9 |
|
| 10 |
var result = Object.entries('abc'); |
| 11 |
|
| 12 |
assert.sameValue(Array.isArray(result), true, 'result is an array'); |
| 13 |
assert.sameValue(result.length, 3, 'result has 3 items'); |
| 14 |
|
| 15 |
assert.sameValue(result[0][0], '0', 'first entry has key "0"'); |
| 16 |
assert.sameValue(result[0][1], 'a', 'first entry has value "a"'); |
| 17 |
assert.sameValue(result[1][0], '1', 'second entry has key "1"'); |
| 18 |
assert.sameValue(result[1][1], 'b', 'second entry has value "b"'); |
| 19 |
assert.sameValue(result[2][0], '2', 'third entry has key "2"'); |
| 20 |
assert.sameValue(result[2][1], 'c', 'third entry has value "c"'); |