Skip to content

Instantly share code, notes, and snippets.

@amaxwell01
Created August 6, 2013 19:42
Show Gist options
  • Save amaxwell01/6167904 to your computer and use it in GitHub Desktop.
Save amaxwell01/6167904 to your computer and use it in GitHub Desktop.
Creating Classes in JavaScript
var user = function(name, age, sex, job) {
this.name = name;
this.age = age;
this.sex = sex;
this.job = job;
};
var andrew = new user('Andrew', 28, 'Male', 'Engineer');
var whitney = new user('Whitney', 27, 'Female', 'Mom');
console.log( andrew.name, andrew.age, andrew.sex, andrew.job );
console.log( whitney.name, whitney.age, whitney.sex, whitney.job );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment