//@target: ES5 var array = [1,2,3]; var sum = 0; for (let num of array) { if (sum === 0) { array = [4,5,6] } sum += num; }