JavaScript references confusion
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/11898651/why-self-defining-function-reference-keeps-pointing-to-the-old-function">why self defining function reference keeps pointing to the old function</a>  </p>
</blockquote>



<p>I am quite confused with javascript reference behavior. please take a look at this code it is very clear javscript in passing the reference not creating new memory location. </p>

<pre><code>Human.prototype = Monkey.prototype;
Human.prototype.name = "human";
Human.prototype.work = "love";

Joker.prototype = Human.prototype;
Joker.prototype.name = "joker";
Joker.prototype.act = "awesome";

joker = new Joker ();
human = new Human ();
human.name = 'joker'; 
</code></pre>

<p>now look at this one it is pretty much clear javascript is creating 2 separate memory location for scareMe and prank  </p>

<pre><code>var scareMe = function () {
   alert("Boo!");
   scareMe = function () {
     alert("Double boo!");
  };
};

var prank = scareMe; 
prank(); // "Boo!"
prank(); // "Boo!"

scareMe(); // "Double boo!"
</code></pre>

<p>please help me to understand this behavior. </p>
