New prefilled array in one step.
How to create new prefilled array in JS?
Noob version:
const foo = new Array(5).fill(0).map((_, index) => index * 2) // [0, 2, 4, 6, 8]
Pro version:
const bar = Array.from({length: 5}, (_, index) => index * 2) // [0, 2, 4, 6, 8]
Tweet