题解 | #数值的整数次方#
数值的整数次方
https://www.nowcoder.com/practice/1a834e5e3e1a4b7ba251417554e07c00
function Power(base, exponent) { let res =1 if(base ===0) return 0 if(exponent>0){ for(let i =0;i<exponent;i++){ res *= base } return res } else if(exponent ===0){ return 1 } else { for(let i =0;i<(-exponent);i++) res =res/base return res } } module.exports = { Power : Power };