Skip to content

Instantly share code, notes, and snippets.

@quephird
Created March 9, 2012 17:04
Show Gist options
  • Save quephird/2007539 to your computer and use it in GitHub Desktop.
Save quephird/2007539 to your computer and use it in GitHub Desktop.
Exercise 1 for JavaScript Masters class
function logCar(car) {
console.log("I'm a " + car.color + " " + car.make) ;
}
// Example call for functional version:
logCar({ color: 'blue', make: 'BMW' });
function Car(make, color) {
this.make = make ;
this.color = color ;
this.log = function () {
console.log("I'm a " + this.color + " " + this.make) ;
} ;
}
// Example call for OO version:
(new Car('Ferrari', 'red')).log();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment