Difference between Function declaration & expression

Notes:

Difference between function declaration and function expression:

Function defined using function declaration:
1.We can call a function before the function definition

wishHi(); // no error
function wishHi()
{
document.write("Hi","<br/>");
}

Function defined using function expression:
1.We cannot call a function before the function definition

wishHi(); // error: wishHi is not a function
var wishHi = function()
{
document.write("Hi","<br/>");
}

Note: Function declarations get hoisted not function expressions

Interview Questions: