1
0
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:
ruanyf 2018-01-11 11:25:46 +08:00
parent 796501b264
commit f847132b3c

View File

@ -480,12 +480,16 @@ for (let x of obj) {
```javascript
function readLinesSync(file) {
return {
next() {
return { done: false };
},
return() {
file.close();
return { done: true };
[Symbol.iterator]() {
return {
next() {
return { done: false };
},
return() {
file.close();
return { done: true };
}
};
},
};
}