new Array(3).fill(0)
Push Method
const LEN = 3const arr = []for (let i=0; i<LEN; i++){arr.push(0)}// [0,0,0]
Mapping method
Personally I think the mapping methods are the cleanest and most versatile
const arr = Array.from({length: 3}, () => 0)// [0, 0, 0]
const arr = Array.from({length: 3}, (x,i) => i)// [0, 1, 2]