Created
June 29, 2015 19:23
-
-
Save gs-ysingh/d8b4f6f36f74201f3cc4 to your computer and use it in GitHub Desktop.
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
//index.js | |
var Project = function() { | |
this.info = {}; | |
this.setValues = function(info) { | |
for(var prop in info) { | |
if(this.info[prop] !== 'undefined') { | |
this.info[prop] = info[prop]; | |
} | |
} | |
}; | |
this.getInfo = function () { | |
return this.info; | |
}; | |
} | |
module.exports = Project; | |
//app.js | |
var Project = require('./Project'); | |
var webApp = new Project(); | |
webApp.setValues({ | |
name: 'Twitter', | |
members: 3, | |
startDate: 2015 | |
}); | |
var mobileApp = new Project(); | |
mobileApp.setValues({ | |
name: 'Facebook', | |
members: 5, | |
startDate: 2016 | |
}); | |
console.log(webApp.getInfo()); | |
console.log(mobileApp.getInfo()); | |
console.log(webApp.getInfo()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment