A

Admin • 833K Points
Coach

Q. Consider the following code snippet:
What does the last statement return ?

Code:
var c = counter(), d = counter();
function constfuncs()
{
var funcs = [];
for(var i = 0; i < 10; i++)
funcs[i] = function() { return i; };
return funcs;
}
var funcs = constfuncs();
funcs[5]()
  • (A) 9
  • (B) 0
  • (C) 10
  • (D) None
  • Correct Answer - Option(C)
  • Views: 26
  • Filed under category JavaScript
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.