mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 10:22:23 +00:00
docs(funcion): fix double colon
This commit is contained in:
parent
dc56713476
commit
01f62521de
@ -944,23 +944,15 @@ let log = ::console.log;
|
||||
var log = console.log.bind(console);
|
||||
```
|
||||
|
||||
双冒号运算符的运算结果,还是一个函数,因此可以采用链式写法。
|
||||
如果双冒号运算符的运算结果,还是一个对象,就可以采用链式写法。
|
||||
|
||||
```javascript
|
||||
// 例一
|
||||
import { map, takeWhile, forEach } from "iterlib";
|
||||
|
||||
getPlayers()
|
||||
::map(x => x.character())
|
||||
::takeWhile(x => x.strength > 100)
|
||||
::forEach(x => console.log(x));
|
||||
|
||||
// 例二
|
||||
let { find, html } = jake;
|
||||
|
||||
document.querySelectorAll("div.myClass")
|
||||
::find("p")
|
||||
::html("hahaha");
|
||||
```
|
||||
|
||||
## 尾调用优化
|
||||
|
Loading…
x
Reference in New Issue
Block a user