DEV Community

Heru Hartanto
Heru Hartanto

Posted on

How to converting string number to number without parseInt or parseFloat

const num = parseInt("100")
Enter fullscreen mode Exit fullscreen mode

Instead of using parseInt or parseFloat we can use + operator

const num = +"100"
num + 5 
// 105
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
eric23 profile image
Eric

Number(“100”)
Should also work.