1. Functions declared by a function declaration statement can be called before the line of code being declared
function doit ()
{
FN ();
function fn ()
{
Alert ("OK");
}
}
Doit (); Ok
2. Anonymous functions can no longer be called before declaring lines of code
function doit ()
{
FN ();
fn= function ()
{
Alert ("OK");
}
}
Doit (); Uncaught REFERENCEERROR:FN is not defined
3. Parameter values can be accessed with arguments when the function does not have an argument of the corresponding formal parameter
function sum ()
{
var number = Arguments.length;
var s = 0;
for (var i = 0; i < number; i++)
{
s + = arguments[i];
}
alert (s);;
}
SUM (1, 2, 3, 4, 5, 6, 7, 8, 8);
SUM (100, 101);
4. Function Scope considerations
var x = 100;
Function Show ()
{
alert (x); Undefined
var x = 2;
alert (x);//2
}
Show ();
The variable x is re-declared inside the function, so the previous x declared is undefined
<<javascript Programming Full Solution >> reading notes functions and closures