main.js
1
2
3
4
5
6
7
const sparse1 = new Array(3);
console.log(sparse1);       // => [<empty slot>, <empty slot>, <empty slot>]
console.log(sparse1[0]);    // => undefined
console.log(sparse1[1]);    // => undefined
const sparse2 = ['white',  ,'blue']
console.log(sparse2);       // => ['white', <empty slot>,'blue']
console.log(sparse2[1]);    // => undefined
Native Browser JavaScript