Compiler Problem


for (var i = 1; i <= 5; i++) {
(function(val) {
setTimeout(function() {
console.log(val);
}, val * 1000);
})(i);
}

Run this code on javascript compiler,its giving wrong output.
And because of this compiler Ihavlost a good opportunity

1 Answer

10 months ago by

Can you share the code link?

10 months ago by Karthik Divi