9 is higher than 871?
I have this sort, and for some reason 9 is greater than 871 for some reason. Is there a way to make it so that it reads the entire number not just the first digit?
2 Replies
Sort of…but it's actually that
"9"
is greater than "871"
. Everything JS gets from HTML is a string, so it's comparing strings. If you Number([cell])
or parseInt([cell], 10)
you'll get numbers and it will compare the way you expect.AHHHHH thanks. Forgot it's strings so I need to parse it.