Javascript allows you to create sparse arrays. These contain runs of empty slots, which are treated differently than slots containing undefined. You can think of them like an object whose keys are only the filled slots' indices. The Array constructor creates a sparse array whose slots are all empty.
You can create sparse arrays in "normal" JS by simply not putting a value between the commas when creating an array.
Spreading a sparse array converts the empty slots into undefined values in some cases, such as spreading into an array. That's why you get an array of undefined values in the example. However, if you spread it into an object, the empty slots are ignored.
let sparseArray = ["a", ,"c"];
console.log(sparseArray); // Array(3) [ "a", <1 empty slot>, "c" ]
console.log([...sparseArray]); // Array(3) [ "a", undefined, "c" ]
console.log({...sparseArray}); // Object { 0: "a", 2: "c" }
console.log({...Array(3)}); // Object { }