Skip to content

Instantly share code, notes, and snippets.

@nola
Last active January 3, 2016 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nola/8425042 to your computer and use it in GitHub Desktop.
Save nola/8425042 to your computer and use it in GitHub Desktop.
creating the constructor then adding new objects via the constructor
// 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