In the below code, a != b when compared with ==
. My initial thought is that JavaScript would use the same conversion for parseFloat as it would with ==
. Can anyone explain what actually happens as I'm a little confused by this. b = 129 when parsed, so it appears parseFloat will parse up to the first non-numeric character.
var a = '129t3.98';
var b;
b = parseFloat(a);
Here is the sample script fiddle.
I was looking to put together a very simple isNumeric()
function using this, but I want to understand it first.