Why does `new Array(…[ 7 ])` produce `Array(7) [ <7 empty slots> ]`?
Why does this code print Array(7) [ <7 empty slots> ] (or an array of undefined, 7 times) instead of an array with the single element 7? const a = [ 7 ]; console.log(new Array(…a)); >Solution : new Array(…a) is the same as saying new Array(7), which will create an empty array with 7 undefined… Read More Why does `new Array(…[ 7 ])` produce `Array(7) [ <7 empty slots> ]`?