var myName = 4;
function myName() {
console.log("xxxx");
}
console.log(typeof myName); //Number
var myNamex;
function myNamex() {
console.log("xxxx");
}
console.log(typeof myNamex); //function
Please refer the fiddle - http://jsfiddle.net/s8a7m1hk/
console.log(typeof myName);
The above log statement logs different value, the only difference is that the variable is assigned a value in one place, and not in another.
Can you tell me how are both code snippet broken down, considering hoisting, closure or any that can be applied.