JavaScript

lazy pagination in JavaScript

JavaScriptAsync/Awaitasync generatorsadvanced

What this snippet does

Async generators are perfect for paginated APIs — each page is fetched only when the next iteration is requested.

Expected output

Page 1: [ 'item1a', 'item1b' ]
Page 2: [ 'item2a', 'item2b' ]
Page 3: [ 'item3a', 'item3b' ]

Why practise typing this

Typing async/await code builds muscle memory for the symbols and indentation JavaScript uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More JavaScript practice

Browse all JavaScript snippets →