tests/auto/qml/ecmascripttests/test262/test/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js
raw| 1 | // Copyright (C) 2011 the V8 project authors. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | /*--- |
| 4 | es6id: 13.1 |
| 5 | description: > |
| 6 | In a normal for statement the iteration variable is freshly allocated for each iteration. Single let binding |
| 7 | ---*/ |
| 8 | let a = []; |
| 9 | for (let i = 0; i < 5; ++i) { |
| 10 | a.push(function () { return i; }); |
| 11 | } |
| 12 | for (let j = 0; j < 5; ++j) { |
| 13 | assert.sameValue(j, a[j]()); |
| 14 | } |