One of the bad parts of JavaScript is that if you use parseInt with something that begins with 0, then it could see the number as a octal.
i = parseInt(014); // Answer: 12
Q: How can I redefine parseInt so that it defaults to radix 10? I'm assuming you would use the prototype method.
Edit:
Maybe I should do this:
$.fn.extend({
parseInt:function(X) {
return parseInt(X,10);
}
});
See Question&Answers more detail:os