mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-25 03:02:21 +00:00
docs(iterator): fix return() #585
This commit is contained in:
parent
796501b264
commit
f847132b3c
@ -479,6 +479,8 @@ for (let x of obj) {
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function readLinesSync(file) {
|
function readLinesSync(file) {
|
||||||
|
return {
|
||||||
|
[Symbol.iterator]() {
|
||||||
return {
|
return {
|
||||||
next() {
|
next() {
|
||||||
return { done: false };
|
return { done: false };
|
||||||
@ -486,6 +488,8 @@ function readLinesSync(file) {
|
|||||||
return() {
|
return() {
|
||||||
file.close();
|
file.close();
|
||||||
return { done: true };
|
return { done: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user