Created
August 29, 2019 00:22
-
-
Save Fishrock123/d430d3cb6ba5ce152b44e8de6e2e61d0 to your computer and use it in GitHub Desktop.
iterators-break-recursion-loop.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* f() { | |
try { | |
yield 1 | |
yield 2 | |
yield 3 | |
} finally { | |
yield* f() | |
} | |
} | |
const iter = f() | |
while (true) { | |
for (const val of iter) { | |
console.log(val) | |
if (val === 2) break | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment