A practical example of this statement is:
parseInt(50) > parseInt('a');
When performing this operation on a console, for example, the result is false
.
The actual code that brought me to this question looks like this:
variableB = parseInt(jQuery('some-element').html());
if(parseInt(variableA) > variableB)
// Faça isso.
else
// Faça outra coisa.
Sometimes some-element
will not be filled with anything at all, causing the value of variableB
to be NaN
. But as 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
.