Basic JavaScript - Passing Values to Functions with Arguments

Tell us what’s happening:
Describe your issue in detail here.

Hi guys,
Please I need help with this, I’ve spent too much time on this and I still can’t figure it out. :smiling_face_with_tear:
Your code so far

function functionWithArgs(param1, param2) {
  console.log(1 + 2);
  console.log(7 + 9);
}

functionWithArgs();

Your browser information:

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

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

The function accepts two parameters. You should log their sum in the console, and then call this function with concrete numbers as parameters.
For now, you have console.log() with numbers. If you pass any numbers as parameters to the function, you don’t get their sum. Change console.log(here create the sum of param1 and param2). Then call the function and put between parentheses concrete numbers as parameters.

1 Like

Let’s break this down into what you have correct and what you need to work on.

Create a function called functionWithArgs that accepts two arguments

You have this part correct. param1 and param2 will represent the two arguments passed to the function.

and outputs their sum to the dev console.

You are using console.log to output something, but it has nothing to do with param1 and param2. See if you can use console.log using param1 and param2, so that the sum of them would be displayed.

Call the function with two numbers as arguments.

Allthough you did call the function, you did not call it with two numbers as arguments. You called it with no arguments. Just call it using any two numbers of your choice. Look at the 2nd paragraph in the challenge description for how to call a function with two arguments like was done with calling the testFun function.

1 Like