Catch Arguments Passed in the Wrong Order When Calling, a Function

Catch Arguments Passed in the Wrong Order When Calling, a Function
0

#1

Tell us what’s happening:
Please help.

Your code so far


let base = 3;
let exp = 2;


function raiseToPower(exp, base) {
  
  return Math.pow(exp, base);

}
let power = raiseToPower(exp, base);
  console.log(power);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function


#2

The arguments are being passed in the wrong order. Take a look at the documentation.


#3

function raiseToPower(exp, base) {
return Math.pow(exp, base);
}
let base = 3;
let exp = 2;
let power = raiseToPower(exp, base);
console.log(power);

That??


#4

You should only need to change this line:

let power = raiseToPower(exp, base);

#5

And what to do.Because I don’t understand it


#6

Change the order of the arguments.

Example:

function myFunction(argument1, argument2) {
   return argument1 + ' ' + argument2;
}

var first = "Hello";
var second = "world";

myFunction(second, first); // "world Hello"

// should be in order

myFunction(first, second); // "Hello world"

#7

let power = raiseToPower(2, 3);
That.


#8

That’s the idea, but you can use the variable names that are provided.


#9

function raiseToPower(exp, base) {
return Math.pow(exp, base);
}
let base = 2;
let exp = 3;
let power = raiseToPower(base, exp);
console.log(power);

YEAH this is right.