Skip to content

Instantly share code, notes, and snippets.

@cburgdorf
Created March 3, 2011 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cburgdorf/853569 to your computer and use it in GitHub Desktop.
Save cburgdorf/853569 to your computer and use it in GitHub Desktop.
//OO Style
var Car = function () {
var self = {};
self.maker;
self.color;
self.log = function () {
console.log("Im a " + self.color + " " + self.maker);
};
return self;
}
var mercedes = Car(); //no need for new because of self :-)
mercedes.color('red');
mercedes.maker('mercedes');
//Functional
var logCar = function (car) {
console.log("I'm a " + car.color + " " + car.maker);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment