Skip to content

Instantly share code, notes, and snippets.

@eliperelman
Forked from nathansmith/parseint.js
Created February 3, 2012 16:58
Show Gist options
  • Save eliperelman/1731127 to your computer and use it in GitHub Desktop.
Save eliperelman/1731127 to your computer and use it in GitHub Desktop.
Makes parseInt have default radix of 10.
// JSLint:
/*global window, parseInt*/
// Conditionally check value, in case
// future implementations of parseInt
// provide native base-10 by default.
(function () {
var _parseInt = window.parseInt;
if (_parseInt('09') === 0) {
window.parseInt = function(str, radix) {
return _parseInt(str, radix || 10);
};
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment