Skip to content

Instantly share code, notes, and snippets.

@JWLangford
Last active October 18, 2022 22:25
Show Gist options
  • Save JWLangford/bc379a2c40953fd590936d806661a2a2 to your computer and use it in GitHub Desktop.
Save JWLangford/bc379a2c40953fd590936d806661a2a2 to your computer and use it in GitHub Desktop.
const numInt = "10"
const convertedInt = parseInt(numInt)
// 10
const numFloat = "10.51"
const convertedFloat = parseInt(numFloat, 10)
// 10
const notANumber = "chicken"
const convertedNaN = parseInt(notANumber)
// NaN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment