parseFloat (string)
-
Resolve floating point number: -
var num = parseFloat ( "3.14" ); console . log (num); //Output 3.14 -
Resolve Integer: -
var num = parseFloat ( "42" ); console . log (num); //Output 42 -
Analyze the numerical value represented by scientific counting method: -
var num = parseFloat ( "1.5e2" ); // 1.5 * 10^2 = 150 console . log (num); //Output 150 -
Resolve values with leading zeros: -
var num = parseFloat ( "007" ); console . log (num); //Output 7 -
Parse strings containing non numeric characters: -
var num = parseFloat ( "3.14abc" ); console . log (num); //Output 3.14 -
Parse an empty string or an unresolved string:
var num = parseFloat ( "" ); //Return NaN
console . log (num); var num = parseFloat ( "Hello" ); //Return NaN
console . log (num);