Q. Which of the following values will be returned by the last statement in the given code?

Code:
functionconstfun()  
{  
var fun =[];  
for(vari=0;i<10;i++)  
        fun[i]=function(){returni;};  
return fun;  
}  
var fun =constfun();  
fun[5]()  
  • (A) 10
  • (B) 12
  • (C) 8
  • (D) 9
πŸ’¬ Discuss
βœ… Correct Answer: (C) 8

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
184
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Praveen Singh
Publisher
πŸ“ˆ
81%
Success Rate