Persist a JSON object to localStorage and read it back.
All snippets
The latest code snippets.
Classic debounce — delay invoking fn until X ms after the last call.
Open a WebSocket, send a message, and log incoming frames.
Minimal Express app with a JSON endpoint.
Compose map, filter, and reduce to transform a list of numbers.
Sort with Array.prototype.sort and a comparator function.
Use named capture groups with the /g flag and matchAll.
Compute a SHA256 hex digest with the node:crypto stdlib.
Safely round-trip JSON with JSON.parse and JSON.stringify.
Node.js stdlib async file read with fs/promises.