Why is comparing an integer with array of length 1 returns true while false with array of length 2 or more?

Viewed 974

Why is comparing 0 with an array of length 1 returns true whereas it returns false for array length of 2 or more ? For example,

var a=[]  //undefined
0<a  //returns false
a.push(1) // [1]
0<a // returns true
a.push(2) // [1, 2]
0<a // return false
a.push(3) // [1, 2, 3]
0<a // return false
7 Answers
Related