Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 05:07
Show Gist options
  • Save masautt/715c78034f26aa6605ceaad32276b750 to your computer and use it in GitHub Desktop.
Save masautt/715c78034f26aa6605ceaad32276b750 to your computer and use it in GitHub Desktop.
How to convert a string to a number in JavaScript?
console.log(parseInt("8675309 hmu :)")) // --> 8675309
console.log(parseFloat("3.14 is PI")) // --> 3.14
// https://gomakethings.com/converting-strings-to-numbers-with-vanilla-javascript/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment