Initial Commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/* JavaScript Object Boilerplate *
|
||||
* @version 1.0
|
||||
* @author - Gerrit Linnemann
|
||||
*/
|
||||
|
||||
|
||||
// Constructor
|
||||
function Animal(input) {
|
||||
// always initialize all instance properties
|
||||
if(typeof input === 'object') {
|
||||
this.name = input.name;
|
||||
this.age = input.age;
|
||||
} else {
|
||||
this.name = input;
|
||||
this.age = -1; // default value
|
||||
}
|
||||
}
|
||||
|
||||
// public methods
|
||||
Animal.prototype.fooBar = function() {
|
||||
|
||||
};
|
||||
|
||||
// private function
|
||||
var myFunction = function() {
|
||||
|
||||
}
|
||||
|
||||
// export the class
|
||||
module.exports = Animal;
|
||||
Reference in New Issue
Block a user