var Human = (function (person) {
this.firstName = "John";
this.lastName = "Doe";
this.age = person.age || 50;
this.eyeColor = person.eyeColor || "blue";
this.toString = function() {
return person.age + ", " + person.eyeColor;
};
});
var pers = new Human({ eyeColor: "Yellow" });
//
console.log(pers);
var SampleClass = (function(localFirstDependencyName, localSecondDependencyName){
'use strict';
var _defaultSettings = {
option: 'option'
}
var constructor = function(settings){
this._settings = $.extend(this._settings || {}, _defaultSettings, settings);
this.publicField = null;
this._protectedField = null;
this._privateField = null;
};
$.extend(constructor.prototype, {
publicConstant: 'Constant',
protectedConstant: 'Constant',
_privateConstant: 'Constant',
//#region Public
publicMethod: function () {
this._protectedMethod();
},
//#endregion
//#region Protected
_protectedMethod: function () {
},
//#endregion
//#region Private
_privateMethod: function(self, value){
},
//#endregion
});
return constructor;
}(globalFirstDependencyName, globalSecondDependencyName));
var human = (function (person) {
this.person = {
firstName : "John",
lastName : "Doe",
age : person.age || 50,
eyeColor : person.eyeColor || "blue",
};
this.getInfo = function () {return person.age + ", " + person.eyeColor; }
return this;
});
var getPerson = new human({ eyeColor: "Yellow" });
//
console.log(getPerson.person, getPerson.getInfo());