search and replace ```\n< with ```\n\n< to ensure there's an empty line before closing tags
1.5 KiB
1.5 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7b85367417b2b2512b3a | Catch Arguments Passed in the Wrong Order When Calling a Function | 1 | 调用函数时捕获以错误顺序传递的参数 |
Description
Instructions
raiseToPower
将基数提升为指数。不幸的是,它没有被正确调用 - 修复代码,因此power
值是预期的8。 Tests
tests:
- text: 你的代码应该固定可变<code>power</code>因此它等于2提升到3功率,而不是3增加到2功率。
testString: assert(power == 8);
- text: 您的代码应使用<code>raiseToPower</code>函数调用的正确参数顺序。
testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g));
Challenge Seed
function raiseToPower(b, e) {
return Math.pow(b, e);
}
let base = 2;
let exp = 3;
let power = raiseToPower(exp, base);
console.log(power);
Solution
// solution required
/section>