Search code examples
stringdouble-quotes

How to replace a string in javascript


Here is my data

data = "67.45"

want to remove the double quotes and wanted my out to be as data = 67.45

What is the best way to achieve Thanks in advance


Solution

  • var data = "67.45"
    
    console.log(parseFloat(data))

    data is having string value. if you want to convert string to float.

    you just need to use parseFloat.

    var data = "67.45"

    parseFloat(data)

    you will get float value