Difference between [undefined × 2] and [undefined, undefined] in JavaScript

From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/of,

Note: this implies an array of 7 empty slots, not slots with actual undefined values

What does it mean?

const foo = Array(2)
undefined
const bar = [undefined, undefined]
undefined
foo[0] === bar[0]
true
foo
[undefined × 2]
bar
[undefined, undefined]

What’s the difference between them? Is there any use case that I can only use one but not the other?


Source: stackoverflow-javascript