Possible Duplicate:
What's the opposite of JavaScript's Math.pow?
2^x=i
Given i, how can we calculate x using Javascript?
You want to take the logarithm of 8000. JS has the Math.log
function which uses base e
, you want base 2
so you can write Math.log(8000) / Math.log(2)
to get the logarithm of 8000 base 2, which is equal to x.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With