DEV Community

Discussion on: Best Ways to Convert a String to Number in Javascript

Collapse
 
newbiebr profile image
Arthur Dao

Thanks for sharing!

+ is my preferred one too. The only problem with + is it does not handle trailing character like:

console.log(+"42a"); // output: NaN