Actually this code is very stupid and you're half correct. The standard built in Array methods like map or forEach don't work on implicitly defined undefined values but on explicit one they do.
For example:
[1,2,3,undefined].forEach(ele => console.log(ele))
> 1
> 2
> 3
> undefined
On the other hand:
[1,2,3,,].forEach(ele => console.log(ele))
> 1
> 2
> 3
So, take the time you dedicate to hating JavaScript to understand the language instead of bitching here you and that stupid jerk above.
For example: [1,2,3,undefined].forEach(ele => console.log(ele)) > 1 > 2 > 3 > undefined On the other hand: [1,2,3,,].forEach(ele => console.log(ele)) > 1 > 2 > 3
So, take the time you dedicate to hating JavaScript to understand the language instead of bitching here you and that stupid jerk above.