1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 10:22:23 +00:00

docs(generator): fix finally #770

This commit is contained in:
ruanyf 2018-11-17 23:54:50 +08:00
parent 13efdcb591
commit 44b4886759

View File

@ -700,7 +700,7 @@ g.next() // { value: 1, done: false }
g.return() // { value: undefined, done: true }
```
如果 Generator 函数内部有`try...finally`代码块,那么`return`方法会推迟到`finally`代码块执行完再执行。
如果 Generator 函数内部有`try...finally`代码块,且正在执行`try`代码块,那么`return`方法会推迟到`finally`代码块执行完再执行。
```javascript
function* numbers () {