Last active
January 3, 2016 06:49
-
-
Save nola/8425042 to your computer and use it in GitHub Desktop.
creating the constructor then adding new objects via the constructor
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
// object constructor: | |
function Person(job, married) { | |
this.job = job; | |
this.married = married; | |
} | |
//function that logs info to console | |
function logger(x){ | |
console.log(x) | |
} | |
// create a "gabby, james" object using the Person constructor! | |
var gabby = new Person("student", true ); | |
var james = new Person("programmer", false); | |
//log the "gabby" object to the console. | |
logger(james); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment