Mathematics/数学

How to calculate log base 2 in JavaScript


JS does not support build in   function. But fortunately, Math Object supply LOG2E(), we can use it to get what we want. that is: LOG2E() * log(N) in formula, N is operand going to be log base 2.