function User ( properties ){ for(var i in properties){ (function(Which){ var p = i; Which["get"+p] = function(){ return properties[p]; }; Which["set"+p] = function(val){ properties[p] = val; }; })(this); } } 此构造器内的方法会循环读取properties里的属性,并分别给当前User对象分配get,set方法! (function(){})(this) 匿名方法 , this代表当前对象User