key-order.js (629B)
1 // Copyright (C) 2018 Kevin Gibbons. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Key enumeration order of result objects matches the order of entries in the iterable. 6 esid: sec-object.fromentries 7 includes: [compareArray.js] 8 features: [Object.fromEntries] 9 ---*/ 10 11 var entries = [ 12 ['z', 1], 13 ['y', 2], 14 ['x', 3], 15 ['y', 4], 16 ]; 17 18 var result = Object.fromEntries(entries); 19 assert.sameValue(result.z, 1); 20 assert.sameValue(result.y, 4); 21 assert.sameValue(result.x, 3); 22 assert.compareArray(Object.getOwnPropertyNames(result), ['z', 'y', 'x']); 23 24 reportCompare(0, 0);