Why my answer is wrong !?

Tell us what’s happening:

Your code so far


function functionWithArgs(a,b) {
 console.log(1 + 2);// console output 3
}

functionWithArgs(7,9) 
 console.log(7 + 9); // console output 16

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

I can’t see any reason why it’d be wrong.
Try it on a different browser. It seems to be a technical error.

It works for me as well, what error message are you getting?

// running tests

functionWithArgs(7,9)

should output

16

. // tests completed // console output 3 3 3

Oh sorry, I see what the problem is. Your function doesn’t do anything other than output 3.

You need to return something.

Something like this should work:

function functionWithArgs(a,b) {
 return a + b;
}
1 Like

which line should I change or delete !!

You should change this from console.log(1 + 2); to console.log(a + b);.

Make sure you understand what is happening though. If you’re stuck let me know. The purpose of these exercises is not to just pass them, but to understand what is happening in the code.

1 Like

It worked now ( It’s really strange )

Why is this strange?

Do you understand what this function is doing?

I need time to get more familiar ( like real practice )

Sounds like a good plan. Good luck!

Thank you. I faced same issues with CSS, I’m still practicing everyday with others by building and deploying in web 3.0
I hope for the better with JavaScript.