Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created November 30, 2009 09:47
Show Gist options
  • Save jakearchibald/245371 to your computer and use it in GitHub Desktop.
Save jakearchibald/245371 to your computer and use it in GitHub Desktop.
function TestClass() {}
(TestClass.prototype.constructor == TestClass); // true
TestClass.prototype = {
myMethod: function() {}
};
(TestClass.prototype.constructor == TestClass); // false
(TestClass.prototype.constructor == Object); // true
// instead...
function TestClass() {}
(TestClass.prototype.constructor == TestClass); // true
glow.lang.extend(TestClass, {}, {
myMethod: function() {}
});
(TestClass.prototype.constructor == TestClass); // true
(TestClass.prototype.constructor == Object); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment