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