Skip to content

Instantly share code, notes, and snippets.

@jordandobson
Created March 3, 2011 21:16
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 jordandobson/853599 to your computer and use it in GitHub Desktop.
Save jordandobson/853599 to your computer and use it in GitHub Desktop.
var Car = function(make, color){
this.make = make;
this.color = color;
};
function logCar(c){
console.log("I'm a " + c.color + " " + c.make);
}
Car.prototype.log = function(){
logCar(this);
};
logCar({ color: 'blue', make: 'BMW' });
(new Car('Ferrari', 'red')).log();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment