Skip to content

Instantly share code, notes, and snippets.

@DavidQL
Created July 27, 2011 03:38
Show Gist options
  • Save DavidQL/1108624 to your computer and use it in GitHub Desktop.
Save DavidQL/1108624 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); // 10
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment