Skip to content

Instantly share code, notes, and snippets.

@thekarel
Created July 21, 2013 12:08
Show Gist options
  • Save thekarel/6048379 to your computer and use it in GitHub Desktop.
Save thekarel/6048379 to your computer and use it in GitHub Desktop.
Check if a variable is a number
// http://stackoverflow.com/a/1830844/129698
if ( !isNaN(parseFloat(variable)) && isFinite(variable) ) {
// Do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment