Courtesy: A Javascript conference video. I forgot the name of the conference. Will update.
var name = 'Mr. Bond';
    (function(){
      if(typeof name === 'undefined'){
          var name = "Mr. Bond";
          sayHello(name);
      } else {
           alert(name);
       }
})();
function sayHello(name){
    alert('hello, ' + typeof name !== 'undefined'? name: 'Mr. Robert!');
}
What this alerts? And, give me the reason for that.