Skip to content

Instantly share code, notes, and snippets.

@JamieMason
Created March 3, 2011 21:05
Show Gist options
  • Save JamieMason/853555 to your computer and use it in GitHub Desktop.
Save JamieMason/853555 to your computer and use it in GitHub Desktop.
javascriptmasterclass.com - exercise 1
// functional version
function LogCar(color, make){
this.color = color;
this.make = make;
}
LogCar.prototype.color = 'Colour-less';
LogCar.prototype.make = 'No-Brand';
LogCar.prototype.log = function(){
return ["I'm a", this.color, this.make].join(' ');
};
// OO version
function Car(obj) {
this.log = function() {
return ["I'm a", obj.color, obj.make].join(" ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment