There shoild be fresh let bindings created for every loop iteration

By design Issue #102616

Details

Created
Apr 27, 2014
Privacy
This issue is public.
Found in build #
0.0010
Reports
Reported by 0 people

Sign in to watch or report this issue.

Steps to reproduce

URL = N/A

URL:
N/A

REPRO STEPS:
Enter the following to IE JavaScript console:

"use strict";
var arr = [];
for (let x = 0; x < 3; x++) {
arr.push(function() {
console.log(x);
});
}
arr.forEach(function(f) { f(); });

EXPECTED RESULTS:
it should print 0 1 2

ACTUAL RESULTS:
it prints 3 3 3

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Suresh J.”

      Changed Status to “By design”

    You need to sign in to your Microsoft account to add a comment.

    Sign in