title: defining an object with var or without var
body: <pre><code>var ninja = { 
    yell: function(n){ 
      return n &gt; 0 ? ninja.yell(n-1) + "a" : "hiy"; 
    } 
  }; 
  console.log( ninja.yell(4) == "hiyaaaa", "A single object isn't too bad, either." ); 
  
  var samurai = { yell: ninja.yell }; 
  var ninja = null; 
  
  try { 
    samurai.yell(4); 
  } catch(e){ 
    console.log( false, "Uh, this isn't good! Where'd ninja.yell go?" ); 
  }
  </code></pre>
  
  <p>the question is <code>Var ninja=null</code> </p>
  
  <p>Is this another object?</p>
  
  <p>or it same as i wrote it in first line?</p>
  
  <p>I guess it is another new object cause i define it with var? </p>
  
  <p>but this is false because out put is false and catch body ran. what the heck is this?
  and i also have the same example like above but this is working differently why?</p>
  
  <pre><code>var obj={name: "faizan", age:31}
      var obj2 = obj;//obj2 pointing to the same memoray location of obj
      console.log("before making null obj::",obj2.name);
      console.log(obj==obj2,"::checking obj==obj2 while var obj2=obj");
      obj=null;  //obj became null
      console.log("after making null obj::",obj2.name);//now this will need to be null but is working why??
  </code></pre>