tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js (549B)


      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. Multi let binding
      7 ---*/
      8 let a = [], b = [];
      9 for (let i = 0, j = 10; i < 5; ++i, ++j) {
     10  a.push(function () { return i; });
     11  b.push(function () { return j; });
     12 }
     13 for (let k = 0; k < 5; ++k) {
     14  assert.sameValue(k, a[k]());
     15  assert.sameValue(k + 10, b[k]());
     16 }
     17 
     18 reportCompare(0, 0);