How does Javascript create an array of fixed length and filled with fixed content?

I want to create an array of length 15
where the first five items are the contents of another one-dimensional array, and the following array values are specified by me (such as empty)

let arr1 = new Array(5)
arr2.map((x)=>{
    arr1.unshift(x)
})
return arr1.slice(0,5)

that"s what I"ve written so far, but I always feel that there are better and more concise ways to write this function


var arr = [1,2,3,4,5].concat(new Array(10).fill(0)); /*[1,2,3,4,5] */
console.log(arr);
Menu