Content filed under “JavaScript”
Convert a 2D array into a flat, 1D array of unique items
Convert a messy multidimensional array into a nice single dimension array of unique items.
Load all focusable elements with JavaScript
A handy helper function that will load all user-focusable elements inside a parent element for you.
Use a set to remove array duplicates
Build a light and global state system
Using Proxies and subscriber functions, we can create an observable, reactive state system with a tiny footprint.
Create a user controlled dark or light mode
Automatic dark and light themes, based on system user-preferences, are handy but in this tutorial, we take that one step further and give our users control.
A progressive disclosure component