Basic JavaScript - Passing Values to Functions with Arguments

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

Please can someone help me out, I’ve been at this for two days now, but it keeps saying functionWithArgs (1, 2) should output 3
I don’t understand where i’m getting it wrong

  **Your code so far**
function functionWithArgs(a, b){
console.log(1 + 2);
console.log(7 + 9);
}
functionWithArgs(1,2);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 8.1.0; JKM-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.101 Mobile Safari/537.36

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

The issue is that you are supposed to use the parameters you passed in. You pass in two numbers:

functionWithArgs(1,2);

And those get accepted into the function as a and b. But you don’t use them, you “hard code” 1 + 2 and 7 + 9. Don’t put numbers in there, use the parameters. That way it will use any numbers that are passed to it and not just what you’ve hard coded.

1 Like

Thanks so much, it worked!, I first had a hard time understanding what you meant by me “hard coding” it, it felt like a big term to my beginners ears lol, but I finally got what you meant, thaks a lot.

We all start with “beginners ears”. This is hard stuff, it takes work. Keep up the good work.

2 Likes

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