A

Admin • 833.24K Points
Coach

Q. What is the result?

Code:
let a = [1,2,3];
a.length = 0;
console.log(a);
  • (A) []
  • (B) [1,2,3]
  • (C) undefined
  • (D) null
  • Correct Answer - Option(A)
  • Views: 26
  • Filed under category JavaScript
  • Hashtags:

Explanation by: Admin

Setting length = 0 clears the array.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.