ParseFloat
From PlainOldWebserver
parseFloat()
var one = parseFloat("3e-3");
var two = parseFloat("23.354");
var three = parseFloat("tr34");
var four = parseFloat("34.4r");
var five = parseFloat(" 34.4 ");
document.writeln("one is "+one);
document.writeln("two is "+two);
document.writeln("three is "+three);
document.writeln("four is "+four);
document.writeln("five is "+five);
Result:
one is 0.003 two is 23.354 three is NaN four is 34.4 five is 34.4
Note that leading alphabetical characters will not produce a desired result.
