Skip to content

Instantly share code, notes, and snippets.

@kennystone
Created December 12, 2011 20:48
Show Gist options
  • Save kennystone/1469022 to your computer and use it in GitHub Desktop.
Save kennystone/1469022 to your computer and use it in GitHub Desktop.
var logCar = function(car) {
console.log("I am a " + car.color + ' ' + car.make);
}
logCar({ color: 'blue', make: 'BMW' });
var Car = function(make, color) {
this.color = color;
this.make = make;
this.log = function() {
console.log("I am 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