MCQs>IT & Programming>JavaScript>for the following code: function foo() { var funcs = []; for (var i = 0; i < 10; i++) { funcs.push(function () { alert('value of i is ' + i); }); } return funcs; } var funcs = foo(); funcs[0](); what will be alerted?
JavaScript MCQs
for the following code: function foo() { var funcs = []; for (var i = 0; i < 10; i++) { funcs.push(function () { alert('value of i is ' + i); }); } return funcs; } var funcs = foo(); funcs[0](); what will be alerted?
Answer
Correct Answer: value of i is 10
Explanation:
Note: This Question is unanswered, help us to find answer for this one