I do not want use each and every time parseInt('08', 10) for each string to integer conversion,
Can we modify parseInt method, so that i can use only parseInt('08') instead of parseInt('08', 10).?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Instead of modifying the built-in function
parseInt, you can define your own function like this:And replace all the occurences of
parseInt(n, 10)you have used in your app withprseInt(n).Fine, if you still wanna redefine, you can do this:
And it works!
Fiddle: http://jsfiddle.net/QKKwv/