Rom1
November 1, 2022, 10:41am
1
Create a function called functionWithArgs
that accepts two arguments and outputs their sum to the dev console.
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:
hbar1st
November 1, 2022, 10:46am
2
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
tsidiku
November 1, 2022, 11:23am
5
how about this:
mod edit : solution redacted
let add = functionWithArgs(3, 16);
console.log(add);
hbar1st
November 1, 2022, 11:27am
6
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.
system
Closed
May 2, 2023, 11:27pm
7
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.