A

Admin • 833K Points
Coach

Q. What will be printed?

Code:
let a = [1, 2];
a[10] = 99;
console.log(a.length);
  • (A) 2
  • (B) 11
  • (C) 10
  • (D) 12
  • Correct Answer - Option(B)
  • Views: 13
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

Setting index 10 makes the array length 11.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.