3/13 Function Syntax


#1

I am having trouble with syntax.

In this example:
var sayHello = function (name){
console.log ("Hello " + name};
};

sayHello("Emily");

Does the keyword 'var' declare the function or does the keyword 'var' declare a variable?
And 'sayHello' is the name of the function?


#2

2 posts were merged into an existing topic: Declaring Function and Variables and giving it a name


#3

The keyword var declares a variable.

A function, in JavaScript, is assignable in the same way but you must use the function keyword to make it a function.


#4

i am having the same problem


#5

@indymac

See my reply.


#6

'var' declares a variable (variable). 'function(argument)' declares the function by assigning it to the variable.


#7

i dont understand this part of functions


#8

I don't understand when the comment says "call the greeting function".


#9

I still dont get it sorry