Skip to content

Instantly share code, notes, and snippets.

@sumanmukherjee03
Created March 8, 2013 15:30
Show Gist options
  • Save sumanmukherjee03/5117225 to your computer and use it in GitHub Desktop.
Save sumanmukherjee03/5117225 to your computer and use it in GitHub Desktop.
Exercise or cars
function logCar(obj) {
console.log("I'm a " + obj.color + " " + obj.make);
}
var Car = function(make, color){
this.make = make;
this.color = color;
};
Car.prototype = (function(){
var logToConsole = function(obj) {
console.log("I'm a " + obj.color + " " + obj.make);
};
return {
log: function() {
logToConsole(this);
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment