Created
June 19, 2018 09:42
-
-
Save GiladShoham/08036095947be3d6a416aeb2f24dfd6f to your computer and use it in GitHub Desktop.
This file contains 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* numbers() { | |
let index = 1; | |
while(true) { | |
yield index; | |
index = index + 1; | |
if (index > 10) { | |
break; | |
} | |
} | |
} | |
function gilad() { | |
for (const num of numbers()) { | |
console.log(num); | |
} | |
} | |
gilad(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment