JavaScript : Convert String To Number

added by JavaScript Kicks
7/31/2019 7:23:59 AM

252 Views

In this quick tip, you'll learn how to convert string to number in JavaScript. For example, how to convert "123" to 123. Using Number method You can use the Number method to convert a string to number. function stringToNumber(input){ return Number(input) } console.log(stringToNumber("123")) // outputs 123 It also works fine in case of decimal points.


0 comments