Cannot continue due to error msg


#1

I don't see any errors in my code, here it is below

var myGreeting = function(joe) {
console.log("greetings from st. paul" + " " + " " + name);

};
myGreeting("Joe");


#2

@objectmaster13146,

the FUNCTION talk

var myFunc = function( param1, param2) {
       //Begin of  anonymous FUNCTION-BODY
       //VARIABLE -myFunc- has an -anonymous function- assigned
       //this -anonymous function- has 2 PARAMETERS param1 and param2
       //param1 and param2 PARAMETERS are used 
       //as -local- VARIABLES throughout the FUNCTION-BODY

      console.log( param1 + " and " + param2 ) ;

      //End of anonymous FUNCTION-BODY
};

If you want to call/execute the anonymous function
you will have to add a pair of parentheses to the variable myFunc
like
myFunc();
As the anonymous function was defined
as having 2 parameters
you have to provide 2 arguments
in our case 2 string VALUES "Alena" and "Lauren"
like
myFunc("Alena","Lauren");

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++ function with 1 parameter using return-statement

var myFunction = function( param1 ) {
       //Begin of FUNCTION-BODY
       //myFunction =function= has 1 PARAMETER param1
       //this param1 PARAMETER is used as a -local- VARIABLE
       //throughout the FUNCTION-BODY

      return param1;

      //End of FUNCTION-BODY
      };

you have defined a myFunction function
which takes 1 parameter param1
this param1 parameter is used
as a variable throughout the FUNCTION-BODY.

If you want to call/execute this myFunction function
and this myFunction function was defined
as having 1 parameter param1
you will have to provide 1 argument
in our case a "number VALUE" 4
myFunction( 4 );

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**

============================================

As you are using the return-statement in your myFunction function
you will only get a return-value no-display.
You can however capture this return-value in a variable
and then use the console.log()-method to do a display.

var theResult = myFunction( 4 );
console.log( theResult );

OR directly

console.log( myFunction( 4 ) );

#3

I appreciate all the information, but as someone new to coding this is a lot to digest. Im simply trying to figure out why the code in front of me is not working. In my opinion I generally understand functions that I am currently on except for calling them.


#4

@objectmaster13146,
In
[short version]
In myGreeting function a have 1 parameter joe
Throughout the myGreeting function
this joe parameter is used as a variable
thus in this case you would write

 console.log("greetings from st. paul" + " " + " " + joe);

As you call your myGreeting function
you are providing 1 argument the string Value "Joe"

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


#5

I don't know whats going on now. I followed your advice and it still says to pass the greeting a name. Thought I just did that

var myGreeting = function (joe) {
console.log("greetings from st. simons" + " " + " " + Joe );

};
myGreeting("Joe");


#6

@objectmaster13146,

Could you provide the Instructions of this exercise ??
Are they asking you to use name as parameter ??


#7

A big part of programming is debugging. That just means figuring out what the heck went wrong with your code. Why didn't it run?

Look at line 9. It has many syntax errors. See how lack of spacing makes debugging hard?
Fix the function on line 9. Make sure the syntax is right. Make sure it looks nice.
Call the greeting function once it is fixed! Don't forget to pass in a specific name.

Joe, I thought was a specific name