Skip to content

Instantly share code, notes, and snippets.

@johnstew
Last active December 12, 2015 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johnstew/4750274 to your computer and use it in GitHub Desktop.
Save johnstew/4750274 to your computer and use it in GitHub Desktop.
Basic JavaScript Class with gets/sets
window.onload = function(){
function Car(type, year, value){
this.type = type;
this.year = year;
this.value = value;
this.setType = function(t){
this.type = t;
}
this.getType = function(){
return this.type;
}
this.setYear = function(y){
this.year = y;
}
this.getYear = function(){
return this.year;
}
this.setValue = function(v){
this.value = v;
}
this.getValue = function(){
return this.value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment