Basic JavaScript - Passing Values to Functions with Arguments

Tell us what’s happening:
Please help show me where the error lies

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

Your code so far


function functionWithArgs(a, b) {


return a + b;

}

console.log(functionWithArgs(1, 2), functionWithArgs(7, 9));

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:

You have not fulfilled the first part of the instructions which say

  1. Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console.

You should not have a return in your function. All this one should do is console.log like the example shows below

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

Then outside of the function all you should do is call the function. Do not use any console.logs outside of the function

1 Like

ohh yes sir it’s done, thank you very much

2 Likes

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