Skip to content

Instantly share code, notes, and snippets.

@matlc
Created August 9, 2011 16:03
Show Gist options
  • Save matlc/1134455 to your computer and use it in GitHub Desktop.
Save matlc/1134455 to your computer and use it in GitHub Desktop.
function logCar(array) {
console.log("I'm a " + array['color'] + " " + array['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