order-property-added.js (529B)
1 // Copyright 2019 Kevin Gibbons. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-enumerate-object-properties 6 description: Properties added to the object during iteration are not enumerated 7 features: [for-in-order] 8 includes: [compareArray.js] 9 ---*/ 10 11 var o = { 12 p1: 'p1', 13 p2: 'p2', 14 p3: 'p3', 15 }; 16 17 var keys = []; 18 for (var key in o) { 19 if (key === 'p1') { 20 o.p4 = 'p4'; 21 } 22 keys.push(key); 23 } 24 25 assert.compareArray(keys, ['p1', 'p2', 'p3']); 26 27 reportCompare(0, 0);