Basic JavaScript - Passing Values to Functions with Arguments

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

Your code so far

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


Your browser information:

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

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

The instruction; " 1. Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console."
Add the two arguments between paretheses after the given function:

(arg1, arg2) for example

Then, console.log statement within the function should contain a sum of those two arguments: arg1 + arg2.

Now, when you call the function with concrete numbers as arguments, those numbers should be printed as output in the console.

Reset the step and do it again.

i have reset the statemet
function functionWithArgs(num1, num2){console.log(1 + 2, 7+9)}

functionWithArgs(7,9);
Failed:functionWithArgs(7,9) should output 16.

What should you have here: concrete numbers or arguments num1 and num2?

If you pass those two arguments num1 and num2 to the function, you should make a calculation with them. The ‘real’ numbers are added to the function when you call it: functionWithArgs(7,9);

so am i to charge to args i have and it not correct

I am confused I can’t seem to understand what am doing wrong

Your statement within the function should return printed sum: (numberOne + numberTwo). Those are arguments, not the numbers here. Don’t put concrete numbers in the sum…

console.log(firstNum + secondNum)

This is guidance.

thanks a lot it really worked

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.