Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created September 29, 2010 19:30
Show Gist options
  • Save ZenCocoon/603376 to your computer and use it in GitHub Desktop.
Save ZenCocoon/603376 to your computer and use it in GitHub Desktop.
// Example call for functional version:
function logCar(object) {
return "I'm a " + object.color + " " + object.make
}
logCar({ color: 'blue', make: 'BMW' });
// Example call for OO version:
var Car = function(make, color) {
this.make = make;
this.color = color;
};
Car.prototype.log = function() {
return "I'm a " + this.color + " " + this.make;
};
(new Car('Ferrari', 'red')).log();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment