jQuery - Convert string to float or double

Find code to convert String to float or double using jQuery. To convert, use JavaScript parseFloat() function parses a string and returns a floating point number.
var sVal = '234.54';
var iNum = parseFloat(sVal); //Output will be 234.54.
Related Post:
The syntax of parseFloat() function is,
parseFloat(string)
If you string contains spaces then only first number will be returned.
var sVal = '23.25 45.25 68';
var iNum = parseFloat(sVal); //Output will be 23.25
This function will only return "NaN", if the first character cannot be converted to a number.

Feel free to contact me for any help related to jQuery, I will gladly help you.
SHARE

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..