DC大牛果然对javascript的理解非常透彻,javascript语言精粹真的物超所值,虽然此书很薄。
1 var mammal = function(spec) { 2 var that = {}; 3 4 that.get_name = function() { 5 return spec.name; 6 }; 7 8 that.says = function() { 9 return spec.saying(); 10 }; 11 12 return that; 13 }; 14 15 var myMammal = mammal({ 16 name: 'Herb', 17 saying: function() { 18 return 'Hello world!!!' 19 } 20 }); 21 22 console.log(myMammal.says());
转载于:https://www.cnblogs.com/qzsonline/archive/2012/07/13/2589748.html
相关资源:逻辑函数化简器