js 次方 开方 对数
次方 ,,用Math.pow(值,次方数)
如:
Math.pow(3,2); 3的平方
Math.Pow(2,3); 2的立方
开方Math.sqrt(值)
如:
Math.sqrt(9); 9 开方,返回结果3
跟Math.pow 相反的函数var a = [1,2,4,32,128];
var b = [];
for(var i=0;i<a.length;i++){
var index = Math.log(a[i])/Math.log(2);
b.push(index);
}
//b = [0,1,2,5,7];
js 次方 开方 对数
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/40092.html
- 上一篇:https本地自签名证书添加到信任证书访问
- 下一篇:js表头标题固定