array-expand.js (625B)
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: Array entry insertion during traversal using for..of 6 info: | 7 New entries inserted into an Array instance during traversal should be 8 visited. 9 es6id: 13.6.4 10 ---*/ 11 12 var array = [0]; 13 var iterationCount = 0; 14 15 var first = 0; 16 var second = 1; 17 18 for (var x of array) { 19 assert.sameValue(x, first); 20 21 first = second; 22 second = null; 23 24 if (first !== null) { 25 array.push(1); 26 } 27 28 iterationCount += 1; 29 } 30 31 assert.sameValue(iterationCount, 2); 32 33 reportCompare(0, 0);