Vidyalelo
JavaScript · Q2

Array And Function

Programming · JavaScript · question 2

Q2

Consider the following code snippet var a1 = [,,,]; var a2 = new Array(3); 0 in a1 0 in a2 The result would be

A.
true false
Answer
B.
false true
C.
true true
D.
None of the above

Answer: Option A

Solution

Answer: Option A
Solution:
a1 has an element with index 0 and a2 has no element with index 0.