0 votes
in JavaScript by
What will be the output of the following given code of JavaScript?

var x1 =[,,,];  

var x2 =newArray(10);  

0in x1   

0in x2  

a) true true

b) false true

c) true false

d) false true

1 Answer

0 votes
by

Answer: C

Reason: As we can see in the given code, the "x1" array is defined but with the null values by which we can easily access the index 0,1,2 of it. We can access the largest index of the array in which any value or even null value is defined. In the "x2" array, we cannot access the index 0 because the "x2" array is declared, but it is not defined till now.

...