Array(3)
yields [ , , ]
, which has a length
of 3.
[1, 2, 3].forEach
loops 3 times, as expected.
Neither Array(3).forEach
nor [ , , ].forEach
loops at all, however.
Why is this? I thought I'd discovered a way of doing something n
times without using for
loops, and am disappointed to find it doesn't work!