parseInt is a javascript function that can't be relied to return NaN in some strings that are not numbers
parseInt('12lol')
returns 12
parseInt('lol12')
returns Nan
A more reliable function to do this is Number()
Number('12lol')
returns Nan
Number('293.2')
returns 293.2
parseFloat has the same defect, don't rely on those.
No hay comentarios:
Publicar un comentario