Skip to content

Instantly share code, notes, and snippets.

@Dragory
Last active December 10, 2015 05:29
Show Gist options
  • Save Dragory/4387946 to your computer and use it in GitHub Desktop.
Save Dragory/4387946 to your computer and use it in GitHub Desktop.
(function() {
var foo = {
'foo': 5,
'bar': function() {
console.log('a');
}
};
var bar = function() {
this.foo = 5;
};
bar.prototype.bar = function() {
console.log('a');
};
var thing = function() {
this.foo = 5;
};
thing.bar = function() {
console.log('a');
};
// var a = new foo; // Syntax error
var b = new bar; // Works
var c = new thing; // Works
console.log(b.bar); // function () { console.log('a'); }
console.log(c.bar); // undefined
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment