javascript hoisting
12 Jan 2016var declaration
hoisted to the top of scope, without assignment.
var a = 1;
function printA() {
console.log(a);
var a = 2;
console.log(a);
}
printA();
//undefined
//2
hoisted to the top of scope, without assignment.
var a = 1;
function printA() {
console.log(a);
var a = 2;
console.log(a);
}
printA();
//undefined
//2