js function compose(f, g, h) { return function (x) {return f(g(h(x))) } } function f(x) {return 'f' + x; } function g(x) { return 'g' + x; } function h(x) { return 'h' + x; } alert(f(g(h('1')))) alert(compose(f,g,h)(1))好像有点换汤没换药 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 换个药吧。。 function compose() { var func = Array.prototype.slice.call(arguments); return function (x) { while (fn = func.pop()) x = fn(x); return x; } } const [f,g,h]=[ x=>`f${x}`, x=>`g${x}`, x=>`h${x}` ] function compos(...funcs){ return x=>funcs.reduce((a,b)=>b(a),x) } const r=compos(f,g,h)('com'); console.log(r); js的prototype问题 Jquery mobile相关 JS连数据库问题 想做成QQ空间那种图片浏览的效果,但是问题多多,高手帮忙改下,,谢 如何得到一个树中选中的节点ID 求一段js代码,将一个开源文件的;都换成回车,方便编辑 按后退返回前一页面怎么能让这个页面马上刷新 如何用js判断 表单的是否存在某个对象呀 如何用事件动态控制表格的背景色? 苦恼的表单提交内容检查???? ajax 提交数据到后端,为何部分字段的值接收不到? js颜色变浅算法
const [f,g,h]=[
x=>`f${x}`,
x=>`g${x}`,
x=>`h${x}`
]
function compos(...funcs){
return x=>funcs.reduce((a,b)=>b(a),x)
}
const r=compos(f,g,h)('com');
console.log(r);