I'm having issues with passing values to Function

I'm having issues with passing values to Function
0

#1

Tell us what’s happening:

Your code so far

// Example
function ourFunctionWithArgs(a, b) {
  console.log(a - b);
}
ourFunctionWithArgs(10, 5); // Outputs 5

// Only change code below this line.

functionWithArgs(1, 2);{
  console.log(1 + 2);
}
FunctionWithArgs(7, 9);{
console.log(7 + 9);  
}

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299.

Link to the challenge:


#2

First you have to declare the function (only once). In the example the function was declared as:

function ourFunctionWithArgs(a, b) {

In your code, you tried to call a function called functionWithArgs (twice), but you have not declared that function.

See if you can create something similar to the example function shown at the top of my reply here. Remember a and b are parameters which act as placeholders for the values which will be passed into the function. You can call them whatever you want (but they can not be a number or start with a number), but then you must use the same names inside the function to do whatever you need to do to meet the challenge requirements.

You do not need to hardcode the values in the console.log statement. Use the a and b variables (or whatever you choose to call them) and to display the sum of the two values.


#3

@Rosie2610

  1. I do not see functionWithArgs defined before it is used
function functionWithArgs(a, b) {
  console.log(a + b);
}
  1. Be careful the second function is different from the first as the F is capitalized
    Javascript is a case sensitive language therefore the function below is a different function from the previous one
function FunctionWithArgs(a, b) {
console.log(a + b);  
}
  1. the only function defined is in the do not change above this line, so that is the only one that will execute properly
function ourFunctionWithArgs(a, b) {
  console.log(a - b);
}
  1. no semicolons in the declaration of the function between the name and open curly such as
    FunctionWithArgs(7, 9);{
    But yes when you make the call as a statement, close with a semi colon

What happened to ourFunctionWithArgs?

Let me know if this clarifies things.

Cheers.
-WWC