Prototyping with a function assignment in Javascript
<p>I have been trying some fundamentals in javascript and here is what I observed.</p>

<p>I wrote a prototype modification method for Function object</p>

<pre><code>Function.prototype.method = function(name, func)
{
   this.prototype[name] = func;
   return this;
}

function pirates(value)
{
   console.log("I just throw away the value!!" + value);
}

pirates.method("my_skill", function(){
   console.log("Pirate skills");
});

new_pirate = new pirates(1234);

//SUCCESS
new_pirate.my_skill(); //prints "Pirate skills"

var someCrappyVariable = function(){
  return function()
  {
     console.log("I am going to just sit and do nothing. Really!");
  }
}();

**//Throws error. WHY???????? This was assigned a function, so ideally prototype should work on this too? Shouldn't it?**
someCrappyVariable.method("crappyFunction", function(){
   console.log("am I doomed?");
});
</code></pre>

<p>Why does last assignment throws an error that someCrappyVariable is not a function, when it was assigned a function reference earlier? I am confused.</p>

<p>Cheers</p>
