DEV Community

Discussion on: JavaScript Secrets

Collapse
 
olgagnatenko profile image
Olga Gnatenko

What about explicit conversion from string to number: str => Number(str)? I think this one is clearer and easier to understand/note for other developers.

Thread Thread
 
abourass profile image
Antonio B.

parseInt(str, 10)

Thread Thread
 
denicmarko profile image
Marko Denic • Edited

Hi Olga. Hi Antonio.
Thanks for reading and taking the time to comment.

There is at least 10 different ways to convert a string to number. Maybe I create a dedicated post about this topic.