利用reduce >

JS高阶编程技巧: 惰性思想【懒】

// 基于函数重构实现惰性思想--------------------let css=function (elem,attr){if('getComputedStyle' in window){css=function(elem,attr){return getComputedStyle(elem)[attr];}}else{css=function(elem,attr){return elem.currentStyle[attr];}}return css(elem,attr);}
