Because when you try to get a property that doesn't exist, it returns undefined , and 0 < undefined is false .

let arr = [1, 2, 3, 4]; console.log(arr.lenght) // undefined console.log(arr.qwerty) // undefined console.log(arr.lenght < 9999) // false console.log(arr.lenght > 9999) // false arr.length = 7 // <-- it's not a good idea for(let i = 0; i < arr.length; i++) {console.log(arr[i])}

EDIT

I said 'javascript is not a strongly typed language' and it is true. But this way of adding new properties it is a feature of prototype-based programming, as @Voo said.

I also said .length=7 it's a bad idea. After reading a little more, in this case I still think it's a little weird to increase the length property after adding elements. Maybe it's fine to truncate, delete elements or empty an array, although in the latter case I would prefer arr=[] instead of arr.length=0 .

There are some interesting examples about length property in the Mozilla documentation.