We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http://www.typescriptlang.org/Playground#src=for(let%20i%20%3D%200%3B%20i%20%3C%2010%3B%20i%2B%2B)%7B%0D%0A%09setTimeout(function()%7B%0D%0A%09%09console.log(i)%3B%0D%0A%09%7D)%3B%0D%0A%7D
for(let i = 0; i < 3; i++){ setTimeout(function(){ console.log(i); }); }
for (var i = 0; i < 3; i++) { setTimeout(function () { console.log(i); }); }
In es6, the first example outputs 0 1 2 But the JS which translated by TS outputs 3 3 3
0 1 2
3 3 3
It would act like es6 if wrapped with (function(i){ /* */ })(i)
(function(i){ /* */ })(i)
for (var i = 0; i < 10; i++) { (function(i){ setTimeout(function () { console.log(i); }); })(i); }
The text was updated successfully, but these errors were encountered:
This has already been implemented in #5208
Sorry, something went wrong.
Duplicate #3915
No branches or pull requests
http://www.typescriptlang.org/Playground#src=for(let%20i%20%3D%200%3B%20i%20%3C%2010%3B%20i%2B%2B)%7B%0D%0A%09setTimeout(function()%7B%0D%0A%09%09console.log(i)%3B%0D%0A%09%7D)%3B%0D%0A%7D
In es6, the first example outputs
0 1 2
But the JS which translated by TS outputs
3 3 3
It would act like es6 if wrapped with
(function(i){ /* */ })(i)
The text was updated successfully, but these errors were encountered: