JavaScriptEasy
How do you convert a string to a number in JavaScript?
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
In JavaScript, you can convert a string to a number using several methods. The most common ones are Number(), parseInt(), parseFloat(), and the unary plus operator (+). For example, Number("123") converts the string "123" to the number 123, and parseInt("123.45") converts the string "123.45" to the integer 123.
