1 - I can reference a function by its name.
function funName () {
//code
}
console.log (funName); // -> function funName () {//code}
console.log (typeof funName); // -> function
2 - I can assign a function to a variable and reference the function by the name of the variable.
var x = function funName () {
//code
}
console.log (x); // -> function funName () {//code}
console.log (typeof x); // -> function
3 - If I assign a function to a variable, I can no longer reference the function by its name.
var x = function funName () {
//code
}
console.log (funName); // -> ReferenceError: funName is not defined
Can someone explain why the latter is the case?
Thanks in advance.