Created
August 6, 2013 19:42
-
-
Save amaxwell01/6167904 to your computer and use it in GitHub Desktop.
Creating Classes in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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