var myObject1 = (function(){
var _name = 'sven'; //Private
return {
getName: function(){ //Public
return _name;
}
}
})();
function myObject2 () {
this.name = "Yorhom"; //Private
this.getName = function (){ //Public
return this.name;
}
}
网友评论