What can i do to differentiate both functions

Tell us what’s happening:
Describe your issue in detail here.
I want to create function functionWithArgs(7, 9), with output eqauls to 16

  **Your code so far**

function functionWithArgs(param1, param2) {
console.log(1 + 2);
}
functionWithArgs();

function functionWithArgs(param1, param2) {
console.log(7 + 9);
}
functionWithArgs();
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

Hello,

I’m not sure what you mean by “differentiate both functions”.

The challenge wants you to use the same function, and then call it with different arguments. The point of writing a function is so that you can reuse it and not have to re-write the same code over and over (remember the D.R.Y. principle?)

You would pass the actual values (arguments) to the function in the function call.

functionWithArgs(1, 2);

functionWithArgs(7, 9);

That is how you call the function. It is the same function, the only thing changing is the arguments being passed to it in each function call.

Inside the function body, use variables to perform the operations with the arguments passed to the function, because you do not always know what those are going to be… so in this case you are using

param1

and

param2

as the variable names… that’s what those are for.

Read the task again - you want to write a function that USES arguments. You wrote two function which take in arguments but never use them.

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