Created
September 28, 2016 06:14
-
-
Save robbestad/8a742dc06dfadb5d1923119ec58a6a49 to your computer and use it in GitHub Desktop.
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
| const splitLettersGen = function*(text) { | |
| let i = 0; | |
| const tokens = text.split(" "); | |
| while (i < tokens.length) { | |
| yield tokens[i]; | |
| i++; | |
| } | |
| }; | |
| const addText = splitLettersGen ("Dette er en test! Dette er nok en test! Jeg tester enda mer."); | |
| setInterval(_ => { | |
| const nextLetter = addText.next(); | |
| if(!nextLetter.done){ | |
| console.log(nextLetter.value); | |
| } | |
| },30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment