Convert the string to Double in JavaScript
In this tutorial, we are going to learn about how to convert the string to a double in JavaScript with the help of examples.
Consider, we have the following string in our code:
const price = "234.123";Now, we need to convert the above string "234.123" to a double 234.123.
Using parseFloat() function
To convert a string to a double, we can use the built-in parseFloat() function in JavaScript.
The parseFloat() function takes the string as an argument and parses it to a double.
Here is an example:
const price= "234.123";
const result = parseFloat(price);
console.log(result);Output:
234.123Additional resources
You can also checkout similar tutorials by reading the following:


