JavaScript之函数式编程思想初探

//result = 3*x + 5;
var Mul3 = function(x){
return 3*x;
}
var Add5 = function(x){
return x + 5;
} var Result = function(Mul,Add){
return function(x){
return Add(Mul(x));
};
} Result(Mul3,Add5)(1);//8

引用文献:

  http://www.ruanyifeng.com/blog/2017/02/fp-tutorial.html

  https://llh911001.gitbooks.io/mostly-adequate-guide-chinese/content/ch2.html#为何钟爱一等公民

  https://zhuanlan.zhihu.com/p/21714695

  

上一篇:获取屏幕宽度,将view移出屏幕再移动回来


下一篇:记一次SqlServer大表查询语句优化和执行计划分析