1.将函数赋值给变量constcontroller={index(props){returnView.index(props)}}等价于constcontroller={index:View.index}2.高阶函数可以将函数作为参数传递另一个函数:functionfilter(array,fn){letresults=[];for(leti=0;i{console.log(fn.length)returnfunctioncurried(...args){if(args.length{returncurried(...args.concat(res))}}returnfn(...args)}}constcurriedAdd=curry(添加);控制台。日志(curriedAdd(1)(2)(3));函数组合,lodash中的fp模块//提取字符串中的第一个字母并将其转换为大写,使用.作为分隔符//worldwildweb===>W.W.Wconstfp=require('lodash/fp');//constfirstLetterToUpper=fp.flowRight(fp.join('.'),fp.map(fp.first),fp.map(fp.toUpper),fp.split(''))constfirstLetterToUpper=fp.flowRight(fp.join('.'),fp.map(fp.flowRight(fp.first,fp.toUpper)),fp.split(''))console.log(firstLetterToUpper('wordwildweb'));