mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +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);
|
var log = console.log.bind(console);
|
||||||
```
|
```
|
||||||
|
|
||||||
双冒号运算符的运算结果,还是一个函数,因此可以采用链式写法。
|
如果双冒号运算符的运算结果,还是一个对象,就可以采用链式写法。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// 例一
|
|
||||||
import { map, takeWhile, forEach } from "iterlib";
|
import { map, takeWhile, forEach } from "iterlib";
|
||||||
|
|
||||||
getPlayers()
|
getPlayers()
|
||||||
::map(x => x.character())
|
::map(x => x.character())
|
||||||
::takeWhile(x => x.strength > 100)
|
::takeWhile(x => x.strength > 100)
|
||||||
::forEach(x => console.log(x));
|
::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