Skip to content

Instantly share code, notes, and snippets.

@gs-ysingh
Created June 29, 2015 19:23
Show Gist options
  • Save gs-ysingh/d8b4f6f36f74201f3cc4 to your computer and use it in GitHub Desktop.
Save gs-ysingh/d8b4f6f36f74201f3cc4 to your computer and use it in GitHub Desktop.
//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