Skip to content

Instantly share code, notes, and snippets.

@zoolu-got-rhythm
Created December 26, 2015 17:43
Show Gist options
  • Save zoolu-got-rhythm/5eda347f3c788344053a to your computer and use it in GitHub Desktop.
Save zoolu-got-rhythm/5eda347f3c788344053a to your computer and use it in GitHub Desktop.
function Car(make, creed){
this.wheels = 4;
this.colour = "red";
this.make = make;
this.model = creed;
}
Car.prototype.getSummary = function(){
return "this car has " + this.wheels + " wheels, is " +
this.colour + ", manufactored by " + this.make + " and is a " + this.model;
};
var instance1 = new Car();
// set properties
instance1["make"] = "ford";
instance1.model = "mustang";
// check properties
console.log(instance1.getSummary());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment