微信小程序:求对数
作者:互联网
function getBaseLog(x, y) { return Math.log(y) / Math.log(x); } // 2 x 2 x 2 = 8 console.log(getBaseLog(2, 8)); // expected output: 3 // 5 x 5 x 5 x 5 = 625 console.log(getBaseLog(5, 625)); // expected output: 4
js这个坑货,在Math里多封装一步能死吗,还得自己写方法
文档:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log
标签:console,log,625,微信,程序,expected,对数,getBaseLog,Math 来源: https://www.cnblogs.com/Jason-c/p/15518145.html