JavaScript/链式操作:修订间差异
来自康健生活
创建页面,内容为“== 引言 == == Proxy == {{leftrightflex|<syntaxhighlight lang="javascript"> const pipe = (function() { return (value, target) => { const cup = []; const t…” |
|||
| 第18行: | 第18行: | ||
})(); | })(); | ||
const target = { | const target = { | ||
add: _ => _ + 1, | |||
sub: _ => _ - 1, | |||
pow: _ => _ * 10, | |||
division: _ => _ / 10 | |||
}; | }; | ||
pipe(5, target).add.get;</syntaxhighlight>|{{consoleout|<pre> | pipe(5, target).add.get;</syntaxhighlight>|{{consoleout|<pre> | ||
6 | 6 | ||
</pre>}}}} | </pre>}}}} | ||