3
A practical example of this statement is:
parseInt(50) > parseInt('a');
When running this operation on a console, for example, the result is false
.
The real code that brought me to this question is similar to this:
variableB = parseInt(jQuery('some-element').html());
if(parseInt(variableA) > variableB)
// Faça isso.
else
// Faça outra coisa.
Sometimes the some-element
will not be filled with anything at all, causing the value of variableB
was NaN
. But how some-element
was not filled with anything, I would like it to be evaluated as if it had been filled with 0. That is, if variableA
is a positive greater than 0, the comparison should return true
.
You could put a condition with Nan or just an 'e' in if
– Rodrigo Santiago
Question in English OS -> http://stackoverflow.com/questions/26982881/why-nan-is-greater-than-any-number-in-javascript
– PauloHDSousa
It would not be good to put the link reference in the question itself?
– Wallace Maxters