杨__羊羊
stackoverflow 是有一个这样的折中方案var human = function() { var _firstName = ''; var _lastName = ''; return { firstName: function() { if (arguments.length === 1) { _firstName = arguments[0]; } else { return _firstName; } }, lastName: function() { if (arguments.length === 1) { _lastName = arguments[0]; } else { return _lastName; } }, fullName: function() { return _firstName + ' ' + _lastName; } };}();human.firstName('Saeed');human.lastName('Neamati');alert(human.fullName());