Functions


#1

Oops, try again. You did not call the greeting function. Pass it a name!

How can We asnwer that question ?

// Below is the greeting function!
// See line 7
// We can join strings together using the plus sign (+)
// See the hint for more details about how this works.

var greeting = function (name) {
console.log("Great to see you," + " " + name);
};

// On line 11, call the greeting function!
var greeting = function (name) {
var sayHello = sayHello("Emily");
console.log("Hello" + " " + "Emily!");
};


#2

@codewhiz71790,

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".**


#3

I had trouble to understand your technical language. In fact, I did not understand anything. Could you give me the answer of the question ? This would be a sharply help !


#4

Essentially he's saying don't create two variables, or functions in this case, with the same name:

var greeting = function (name) {
 console.log("Great to see you," + " " + name);

var greeting = function (name) {
 var sayHello = sayHello("Emily");

Essentially, everything after:

// On line 11, call the greeting function!

is incorrect :confused:

Try just calling the greet function instead of making another one:

greeting("Emily");


#5

@codewhiz71790,
Change your

// On line 11, call the greeting function!
var greeting = function (name) {
 var sayHello = sayHello("Emily");
 console.log("Hello" + " " + "Emily!");
};

into

 // On line 11, call the greeting function!
 greeting("Emily");

#6

Oh, yeahhhh, the magic has just appear. Thank you professor !


#7

tell me some clue to understand this sir.i am in confusion