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
To convert a string to a double, we can use the built-in
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);