Skip to content

Instantly share code, notes, and snippets.

@FLYBYME
Created November 24, 2010 02:36
Show Gist options
  • Save FLYBYME/712997 to your computer and use it in GitHub Desktop.
Save FLYBYME/712997 to your computer and use it in GitHub Desktop.
What way is better?
function boo(){
this.someShit = true;
}
//this is how im doing my prototype for each method
boo.prototype.too = function(val){
this.moreShit = false;
}
boo.prototype.uoo = function(val){
this.evenMoreShit = true;
}
//or should i do it like this
boo.prototype = (function(){
//some private shit
return {
uoo: function(val){
this.evenMoreShit = true;
},
too: function(val){
this.moreShit = false;
}
}
})();
//or should i do it like this
boo.prototype = {
uoo: function(val){
this.evenMoreShit = true;
},
too: function(val){
this.moreShit = false;
}
};
var ohMy = new boo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment