Created
June 19, 2018 06:43
-
-
Save rajatgeekyants/56038588198187b6973e937ffc5f37aa 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 rajat() { | |
for (const num of numbers()) { | |
console.log(num); | |
} | |
} | |
rajat(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment