Is it possible to add instance methods to all "classes" in JavaScript?
<p>This is more of an exploratory question, seeing how the core JavaScript stuff works.  I realize the convention is to not override any core JavaScript classes, but I just can't seem to wrap my head around this one.</p>

<p>You can create what acts like "class methods" in JavaScript by adding to the core <code>Function</code> prototype like this:</p>

<pre><code>Function.prototype.class_method = function() {
  console.log("class method called")
}

var User;
User = (function() {
  function User() {}
  return User;
})();

User.class_method(); // "class method called"
</code></pre>

<p>My question is, is there a way to add "instance methods" in a similar way?  Something crazy like this, but what's below doesn't work (or make any sense):</p>

<pre><code>alias = Function.prototype.constructor;
Function.prototype.constructor = function() {
  child = this;
  child.prototype.instance_method = function() {
    console.log("instance method called");
  }
  alias.apply(child);
}

var user = new User();
user.instance_method(); // method doesn't exist
</code></pre>

<p>It's almost like you'd need to override the <code>Function</code> class' <code>constructor</code> method and access the <code>prototype</code> from there.  Is this possible?</p>

<p>It does work if you add to the <code>Object.prototype</code> like this:</p>

<pre><code>Object.prototype.instance_method = function() {
  console.log("instance method");
}

var user = new User();
user.instance_method(); // "instance method called"
</code></pre>

<p>But that doesn't seem right either, mainly because seeing the output in the node.js console from <code>console.log({});</code> change is confusing:</p>

<pre><code>console.log({});
// {};

Object.prototype.instance_method = function() {
  console.log("instance method");
}

console.log({});
// {"instance_method": [Function]}
</code></pre>
