Skip to content

Instantly share code, notes, and snippets.

@seanstrom
Last active August 29, 2015 14:11
Show Gist options
  • Save seanstrom/a9d5bdbe382335d2b6ad to your computer and use it in GitHub Desktop.
Save seanstrom/a9d5bdbe382335d2b6ad to your computer and use it in GitHub Desktop.
Exploring Constructors and Factories in Javascript - Constructor Example
var Person = require('./person')
var sean = new Person('Sean Hagstrom', 20)
console.log(sean.name) // Sean Hagstrom
console.log(sean.age) // 20
function Person(name, age) {
this.name = name
this.age = age
}
module.exports = Person
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment