DEV Community

Weird Javascript?

Prasham Ashesh on October 24, 2019

const a = [1]
a[3] = 3
console.log(a.length);

//What do you expect the output to be?

Collapse
 
pracoon profile image
Prasham Ashesh

Answer: 4