for await...of: Paginated APIs as a Simple Loop
Async generators hide the pagination bookkeeping - cursors, hasMore flags, page counters - behind a clean loop that fetches pages only as you consume them.
Software Engineer
I build web applications and share what I learn along the way.
Step-by-step programming tutorials on PHP, JavaScript, Laravel, WordPress and more.
Async generators hide the pagination bookkeeping - cursors, hasMore flags, page counters - behind a clean loop that fetches pages only as you consume them.
sort() silently rearranges the original array - a bug factory in shared state. ES2023 shipped non-mutating twins for the worst offenders, plus with() for single-item replacement.
ES2021 added three assignment operators that collapse the most common if-statements in JavaScript. Knowing when ??= beats ||= is the part that matters.
jQuery lets you define custom pseudo-selectors - :external, :blank, :offscreen - that work in every $() call, filter() and delegation rule in your codebase.
strtotime and DateTime parse a small English grammar - "last day of next month", "second friday of january" - that replaces whole functions of calendar math.
match() is not just a stricter switch. Feed it true as the subject and every arm becomes an arbitrary condition - an elegant, exhaustive replacement for elseif ladders.
FETCH_KEY_PAIR, FETCH_UNIQUE, FETCH_GROUP and FETCH_COLUMN reshape query results at fetch time - the id-indexed maps and grouped arrays you keep building with foreach loops.
List bullets and text-highlight colors are both fully styleable with dedicated pseudo-elements - no list-style: none rebuilds, no browser defaults clashing with your brand.
Gradients famously cannot be transitioned - until you teach the browser that your custom property is a color or angle. @property makes CSS variables animatable with types.
One CSS property tells the browser to skip layout and paint for off-screen sections entirely. On long pages it can cut initial rendering work dramatically - no virtualization library needed.
Numbered steps, section headings like "2.3", even line numbers - CSS counts elements natively, updates automatically when content is reordered, and needs zero markup changes.
Style a form field wrapper based on the input inside it, a card based on whether it has an image, a layout based on its content - all in pure CSS with :has().