I need a method in a javascript Math object that computes the logarithm of any base. So basically I did this:
Math.log_b=function(b,x){return Math.log(x)/Math.log(b);}
What is the disadvantage of extending the built-in function?
To make my situation clearer, I take user input and replace it with the corresponding function names of the Math object and passing it to eval for calculation. If this is not clear, my dilemma, in my case, I must use eval (even if it is evil), and the extension of the function of the Math object is best suited for my case.
Is there the possibility of some strange errors or others when I extend the built-in function, for example, or are these absolutely normal things?
source share