I need to compare two numeric values for equality in Javascript. The values may be NaN as well. I\'ve come up with this code:
NaN
if (val1 == val2 |
As long as you know these two variables are numeric, you can try:
if (val1 + '' == val2 + '')
It turns the two values into strings. A funny answer, but it should work. :)