Created
March 3, 2011 21:09
-
-
Save cburgdorf/853569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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