Tell us what’s happening:
Here is The question :
Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console.
Call the function with two numbers as arguments.
Here is my answer :
const functionWithArgs = (num1, num2) => {
return num1 + num2;
}
console.log(functionWithArgs(1, 2)); // Outputs: 3
console.log(functionWithArgs(7, 9)); // Outputs: 16
But it is error. it says :
// running tests
functionWithArgs(1,2) should output 3.
// tests completed
// console out
Your code so far
const functionWithArgs = (num1, num2) => {
return num1 + num2;
}
console.log(functionWithArgs(1, 2)); // Outputs: 3
console.log(functionWithArgs(7, 9)); // Outputs: 16
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Basic JavaScript - Passing Values to Functions with Arguments