If I have the following:
const array = new Array(5)
console.log(array)
array.forEach(() => console.log('Hello')) // does not work
I would expect to see 5 'Hellos', but it seems JS doesn't even get into the loop. Why?
What I was trying to accomplish was initializing an array of objects like the following:
const users = (new Array(5)).map(() => ({name:''}))
console.log(users)