var Hoisting.js

var defaultname = "John";
var name = "rayn";

function doit() {
  if(!name){
   		var name = defaultname;
  }
  return name;
}

var ourname = doit();
console.log(ourname); //John
// because name inside function will have more priority over outside name variable. 
// And, this inside name variable will be declared in memory as undefined due to hoisting.
imtrinity94