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.
In the code that you posted the first thing you did was try and make a function, but you forgot the curly brackets {//enter what you want the function to do here//}. You then properly made a function with two console.logs, but you used actual numbers for the parameters, which i don’t think works. You then called the function with the arguments "Hello" and "World".
here is an example:
//lets make our function
function thisIsTheFunctionName (thisIsAParameter, thisIsTheSecondParameter) {
//use the parameters in your function to use there values
console.log(thisIsAParameter + '-' + thisIsTheSecondParameter)
}
//lets call our function
thisIsTheFunctionName('first argument being sent that will be stored in thisIsAParameter', 'the second argument being sent that will be stored in thisIsTheSecondParameter')
//^^^ function call
So don’t use just numbers as parameter names, and then use those parameters inside the curly brackets {} to add the two values together from the function call (the arguments).
Sorry for responding late, but which part is confusing you ?
Take a look at the comments I’ve placed in your code.
The first thing your code does, is it gives an error. “Unexpected token” and points to the parameters of the function, to avoid that error letters shall be used as parameters.
A proper way of defining/declaring a function :
function functionName(parameter) {
// code to be executed when function is called
}
functionName(Argument); /* function call , it executes any code
that is in the curly braces where the function is defined. */
The value placed in the argument of the function call, is used at all places where the parameter is mentioned inside the function code.
Also take a look at the above comment for a great example of how Arguments and parameters work.
remember that you have to use the parameters inside your function to use the values passed to them (arguments). in this case the parameters in your new function are one and two, but inside the function you are not adding them together, you are always adding 1+2, which will always be 3.
so when you call the function functionWithArgs(7,9) you are passing the arguments with the value of 7 and 9, but never using them in your function.