Skip to content

Instantly share code, notes, and snippets.

@chamix
Created October 27, 2013 00:11
Show Gist options
  • Save chamix/7176222 to your computer and use it in GitHub Desktop.
Save chamix/7176222 to your computer and use it in GitHub Desktop.
This is one way to create a class in JavaScript
function car(model, year, color){
this.model=model;
this.color=color;
this.year=year;
this.getInfo=function(){
return this.model + " | " + this.year + " | " + this.color;
};
};
var myCar=new car("Citroen C4","2012","negro");
console.log(myCar.getInfo());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment