Skip to content

Instantly share code, notes, and snippets.

@KrystianP
Last active December 20, 2015 02:09
Show Gist options
  • Save KrystianP/6054362 to your computer and use it in GitHub Desktop.
Save KrystianP/6054362 to your computer and use it in GitHub Desktop.
basic js function
var per = function(imie, naziwsko){
var person = {};
Object.defineProperties(person, {
imie : {
value: imie,
},
naziwsko : {
value: naziwsko ,
writable: true,
enumerable : true
},
fullName : {
get : function (){
return this.imie + ' ' + this.naziwsko
},
set : function (value){
this.imie = value,
this.naziwsko = value
}, configurable : true
}
});
return person;
} // end per
/*var person = (function (person){
person.name = function(){
return 'xxxxx';
};
Object.defineProperties(person, {
test : {
value : 'vvv',
writable : true
}
});
return person;
}(person || {}));
var x = person;
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment