列表

详情


FED25. 幂

描述

请补全JavaScript函数,要求返回底数为第一个参数,幂为第二个参数的数值。

原站题解

HTML/CSS/JavaScript 解法, 执行用时: 948ms, 内存消耗: 151020KB, 提交时间: 2022-04-16

{"css":"","js":"function _pow(number,power) {\n    // 补全代码\n    let num=number;\n    for(let a=2;a<=power;a++){\n        num*=number;\n    }\n    return num;\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1679ms, 内存消耗: 77808KB, 提交时间: 2022-02-08

{"css":"","js":"function _pow(number,power) {\n    // 补全代码\n    return Math.pow(number,power)\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1682ms, 内存消耗: 77772KB, 提交时间: 2022-02-09

{"css":"","js":"function _pow(number,power) {\n    // 补全代码\n    var b=1\n    for(var a=power;a>0;a--){\n        b*=number\n    }\n    return b\n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1682ms, 内存消耗: 77792KB, 提交时间: 2022-02-08

{"css":"","js":"function _pow(number,power) {\n    // 补全代码\n    var a=1;\n    for (let index = 1; index <= power; index++) {\n              a=a*number;\n                \n     }\n     return a;\n            \n}","html":"","libs":[]}

HTML/CSS/JavaScript 解法, 执行用时: 1684ms, 内存消耗: 77804KB, 提交时间: 2022-02-08

{"css":"","js":"function _pow(number,power) {\n    // 补全代码\n    return Math.pow(number , power)\n}","html":"","libs":[]}

上一题