When "null" is included in the elements of an array, it counts the length of the array. But βzeroβ should not mean any value. Then why is this happening?
var myArray = ["pizza", "burger", null];
var test = function (input) {
return input.length;
};
document.write(test(myArray));
Run codeHide result
Frost source
share