var add = function (a, b) {
return a + b;
};
Invoking a function suspends the execution of the current function, passing control and parameters to the new function.
In addition to the declared parameters, every function receives two additional parameters: this and arguments.
this = object
this = global
var sum = add(3, 4);
this = new object instance
var myQuo = new Quo("confused");
this = whatever is passed in
var array = [3, 4];
var sum = add.apply(null, array); // sum is 7
A bonus parameter that is available to functions when they are invoked is the arguments array. It gives the function access to all of the arguments that were supplied with the invocation
The return statement can be used to cause the function to return early.
When return is executed, the function returns immediately without executing the remaining statements.
A function always returns a value. If the return value is not specified, then undefined is returned.
http://blog.jhades.org/really-understanding-javascript-closures/