4 ms·
Hmm... I think you might find this a little more flexible in the long run: String.prototype.toInt = function (base) { if (typeof base == 'undefined')
by jherdman 16y ago
Hmm... I think you might find this a little more flexible in the long run:
String.prototype.toInt = function (base) {
if (typeof base == 'undefined') base = 10;
return parseInt(this, base);
}
Smart defaults are always best, but there's no real need to handicap the users of your API.