Skip to content

Instantly share code, notes, and snippets.

@j1mmie
Last active August 29, 2015 14:23
Show Gist options
  • Save j1mmie/bd674a9f2cd843fe297e to your computer and use it in GitHub Desktop.
Save j1mmie/bd674a9f2cd843fe297e to your computer and use it in GitHub Desktop.
Javascript int parsing cheatsheet
value parseInt(value) +value value|0
0 0 0 0
10 10 10 10
10.9 10 10.9 10
-1 -1 -1 -1
-1.9 -1 -1.9 -1
'10' 10 10 10
'ten' NaN NaN 0
null 0 NaN 0
undefined NaN NaN 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment