Basic JavaScript - Passing Values to Functions with Arguments

  1. Create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console.
  2. Call the function with two numbers as arguments.Tell us what’s happening:
    Describe your issue in detail here.

**Your code so faI have tried so many different ways and now I am completely lost!

function functionWithArgs((a, b), (c, d)) {
  console.log((a, b), (c, d));
}
functionWithArgs(3, 16);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

let us say that i want a function called logNames that takes two arguments, first name and last name.
to create it i would write this

function logNames(first,last) {
  console.log(first);
  console.log(last);
}

then I can call this function like this

logNames(“Hana”, “Bar”);

and the output in the console will be

Hana
Bar

Hopefully this example will help you understand more what is needed for this exercise.

1 Like

thank you, that helped !

1 Like

how about this:

mod edit : solution redacted

let add = functionWithArgs(3, 16);

console.log(add);

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.