Created
August 5, 2011 15:41
-
-
Save DavidQL/1127800 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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