Syntax

const arr2 = new Array(2).fill(undefined);
    // [undefined, undefined]