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