What's the opposite of JavaScript's Math.pow?

前端 未结 2 1707
一整个雨季
一整个雨季 2020-12-09 08:35

I\'m having a mental block here, and algebra not really being my thing, can you tell me how to re-write the JavaScript code below to derive the variable, c, in

相关标签:
2条回答
  • 2020-12-09 08:54

    Logarithms. You want the logarithm of a. B is the base, c is the exponent, so

    logb a = c

    0 讨论(0)
  • 2020-12-09 09:18
    c = Math.log(a)/Math.log(b)
    
    0 讨论(0)
提交回复
热议问题