Basic JavaScript - Passing Values to Functions with Arguments

Been working for a minute on this issue… can someone please help me find my wrong? TIA!

Your code so far

function functionWithArgs (num1, num2) {
  console.log(1 + 2);
  console.log(7 + 9);
}
functionWithArgs(1 + 2);//Outputs 3
functionWithArgs(7 + 9);//Outputs 16

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 are not using the function parameters num1 or num2 at all.

Here you are calling your function with one argument, 1 + 2, not two arguments.

Your function isn’t really outputting anything

ditto

This basically keeps me in the exact same spot I’ve been in… any way you could direct me maybe a little bit? What could I do to better understand this?

I’m not sure how the problems I pointed out “keep you in the exact same spot”?

You are not using num1 or num2 at all. To fix this, your code must actually use num1 and num2 inside of the body of your function instead of hard coded numbers 1, 2, 7, and 9.

This doesn’t actually call your function with two arguments. You are calling the function with one argument, 1 + 2, instead of two separate arguments 1 and 2. To fix this, don’t call your function with one argument. Instead, use a comma separated list of two arguments.

Thank you, the general responses were what kept me in the same spot. Once you put some detail in there, I understood it fine.

In general, I try to give you enough information so that you can try to fix the problems yourself instead of being a ‘show off’ who tells you exactly what to do and is remotely piloting your fingers on the keyboard, bypassing your learning :upside_down_face:

I understand completely, but without coding experience in my past, it’s not an easy thing to learn and understand. With how many other pages that are for this exact reason, the help should be more direct… but again, no experience here compared to some “show offs”.

Its a balancing act. If I only give explicit help that tells you what to do without thinking, you will not develop the ability to see an issue and work through how to fix it on your own.

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