Pasquale Mangialavori Posted on Jan 26, 2021 Typewriter effect with vanilla async generators functions #javascript #typewriter #asyncgenerators #webdev Easy peasy lemon squeezy! Top comments (2) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Collapse Expand lionel-rowe lionel-rowe lionel-rowe Follow Joined May 19, 2019 • Jan 26 '21 Dropdown menu Copy link Hide Nice demo! Note that strings are already iterable, so you can simplify spell like this: async function* spell({ sentence, slowness = 75 }) { for (const char of sentence) { await delay(slowness); yield char; } } Enter fullscreen mode Exit fullscreen mode Collapse Expand Pasquale Mangialavori Pasquale Mangialavori Pasquale Mangialavori Follow Location Barcelona, Spain Work Front-End Developer Joined Nov 27, 2018 • Jan 26 '21 Dropdown menu Copy link Hide True! It actually implements Symbol.iterator. thanks for pointing it out. :) Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Nice demo! Note that strings are already iterable, so you can simplify
spell
like this:True! It actually implements Symbol.iterator. thanks for pointing it out. :)