2018-10-12 15:37:13 -04:00
---
title: Catch Arguments Passed in the Wrong Order When Calling a Function
---
2019-07-24 00:59:27 -07:00
# Catch Arguments Passed in the Wrong Order When Calling a Function
---
## Problem Explanation
2018-10-12 15:37:13 -04:00
```javascript
function raiseToPower(b, e) {
return Math.pow(b, e);
}
```
- The above function is used to raise the base number `b` to the power of the exponent `e` .
- The function must be called specifically with variables in the correct order. Otherwise the function will mix up both variables and return an undesired answer.
2019-01-15 16:53:11 -06:00
- Make sure the variable `power` is implementing the `raiseToPower` function correctly.
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
---
## Solutions
< details > < summary > Solution 1 (Click to Show/Hide)< / summary >
2018-10-12 15:37:13 -04:00
```javascript
2019-07-24 00:59:27 -07:00
function raiseToPower(b, e) {
return Math.pow(b, e);
}
let base = 2;
let exp = 3;
2018-10-12 15:37:13 -04:00
let power = raiseToPower(base, exp);
2019-07-24 00:59:27 -07:00
console.log(power);
2018-10-12 15:37:13 -04:00
```
2019-07-24 00:59:27 -07:00
< / details >