JavaScript/链式操作:修订间差异
来自康健生活
创建页面,内容为“== 引言 == == Proxy == {{leftrightflex|<syntaxhighlight lang="javascript"> const pipe = (function() { return (value, target) => { const cup = []; const t…” |
小 文字替换 -“{{leftrightflex|”替换为“{{Double-columns|” |
||
| (未显示同一用户的1个中间版本) | |||
| 第1行: | 第1行: | ||
== 引言 == | == 引言 == | ||
== Proxy == | == Proxy == | ||
{{ | {{Double-columns|<syntaxhighlight lang="javascript"> | ||
const pipe = (function() { | const pipe = (function() { | ||
return (value, target) => { | return (value, target) => { | ||
| 第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>}}}} | ||