Why new Array(4).join("ha")
yields "hahaha" and not "undefinedhaundefinedha .." ?
var arr = new Array(4);
alert( arr[0] ); // produces `undefined`
Elements of the array that are undefined
or null
are converted to the empty string. It's right there in the documentation.
If an element is undefined or null, it is converted to the empty string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With