array-expand-contract.js (606B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: > 6 Array entry insertion and removal items during traversal using for..of 7 info: | 8 New entries inserted into an Array instance during traversal should not be 9 visited if they are removed prior to visitation. 10 es6id: 13.6.4 11 ---*/ 12 13 var array = [0]; 14 var iterationCount = 0; 15 16 for (var x of array) { 17 assert.sameValue(x, 0); 18 19 array.push(1); 20 array.pop(); 21 22 iterationCount += 1; 23 } 24 25 assert.sameValue(iterationCount, 1); 26 27 reportCompare(0, 0);