Skip to content

Instantly share code, notes, and snippets.

@DavidQL
Created August 5, 2011 15:41
Show Gist options
  • Save DavidQL/1127800 to your computer and use it in GitHub Desktop.
Save DavidQL/1127800 to your computer and use it in GitHub Desktop.
(function() {
// convert a string to a number.
// it uses base 10 by default
var foo = parseInt('78'); // 78
// repeat, with a different number
// this time it's base 8 by default?
var wtf = parseInt('08'); // 0
// always provide parseInt()
// with a base 10 param
var allbetter = parseInt('08', 10); // 8  
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment