Need help urgently

Tell us what’s happening : Cant pass numbers as arguments
Describe your issue in detail here.

  **My code so far**
function functionWithArgs(1, 2) {
  console.log(1 + 2);
}
function functionWithArgs(7, 9) {
console.log(7 + 9);
}
  **Your browser information:**

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

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

You need to use variable names, not values, in the parameter list. In the example you were given:

function testFun(param1, param2) {
  console.log(param1, param2);
}

The function give the names “param1” and “param2”. They just chose those name. They could be “apple” and “elephant”. It could have been this:

function testFun(apple, elephant) {
  console.log(apple, elephant);
}

The function declaration:

function testFun(apple, elephant) {

tells JS that this function will have two variables passed to it. It will store the first one in a variable called “apple” and the second one in a variable called “elephant”.

You need to do something similar, pick names for your two parameter variables and then use those in your function.

1 Like

Thanks. i solved the challenge.

You use the values when you’re calling the function after the declaration.

Example:
[redacted by mod]

Please don’t just give people the solution, especially to curriculum. We try to help them learn, by guiding them to the answer.

1 Like