Help with functions


How do I use functions and name them. Thanks

var thisIsTheFunctionName  = function([parameter,parameter2,...]){
stuff you want to do

thisIsTheFunctionName([argument,argument2,...]) //to actually make it run

where the [] indicates that this part is optional. Could you be a bit more specific on what you want to do?


I want to name a function


I also don't understand how to use them. Whats their purpose?


This means that instead of the name after var you use what you want to be the function name e.g.

var greeting = function(){}

would mean that the function's name is greeting.


Ok Thanks, I figured it out.