The typeof operator returns a string. A string is compared by its numerical value.
So, the comparison order < :
type charCode ("tfnosux".charCodeAt(i)) Example boolean 98 true function 102 Date number 110 123 object 111 [] string 115 "" undefined 117 undefined xml 120 <x></x>
tfnosux are the first type characters. The charCodeAt method returns a numeric charCode character in JavaScript.
I added an example of each type in the previous block. Most JavaScript developers are aware of the first types. The final xml type is less well known and can be obtained using typeof on EX4 .
typeof demo: http://jsfiddle.net/9G9zt/1/
Rob w source share