All tags
javascript
Narrow down
Web88
- Tip
node --inspect-brk app.jsnode --inspect-brk pauses a Node script on its first linePause a Node.js script on line one so a debugger can attach before anything runs3 Dec 2026 - Tip
user.id === 42Add a condition to a Chrome DevTools breakpointPauses the debugger on a line only when your condition is true.2 Dec 2026 - Tip
$x(path [, startNode])$x() runs an XPath query in the DevTools consoleFinds page elements with an XPath expression and returns them as an array.2 Dec 2026 - Tip
console.assert(items.length > 0, 'cart is empty', items)Console.assert() only logs when your condition is falsePrints an error to the console only when the checked condition fails.2 Dec 2026 - Tip
document.designMode = "on"Document.designMode = "on" makes a whole page editableTurns the entire page into an editable document so you can type over any text.2 Dec 2026 - Tip
function save(item) {Console.trace() prints the call stack that led to a lineLogs a stack trace so you can see which code path called a function.2 Dec 2026 - Tip
obj?.propJavaScript ?. stops a chain at null or undefined instead of throwingReads a property or calls a function only when the value in front of it exists.2 Dec 2026 - Tip
const filePath = String.raw`C:\Development\profile\about.html`;JavaScript String.raw keeps backslashes as you typed themTurns a template literal into a string where backslashes stay as written.2 Dec 2026 - Tip
Windows and Linux: Ctrl+BCtrl+B turns the Firefox console into a multi-line editorWrite longer snippets in the console without Enter running them too early.1 Dec 2026 - Tip
queryObjects(Promise)QueryObjects() in the DevTools console finds every instance of a classCount the live objects of one type while hunting a memory leak.1 Dec 2026 - Tip
inspect(document.querySelector('footer'))Inspect() jumps from the DevTools console to an element in the pageOpen the Elements panel on exactly the node your selector returns.1 Dec 2026 - Tip
Console > Create Live ExpressionA DevTools live expression keeps a changing value pinned above the consoleWatch a value update by itself instead of typing it again and again.1 Dec 2026 - Tip
right-click the node > Store as global variableStore as global variable in DevTools gives a clicked element a nameTurn something you found by clicking into a variable you can script.1 Dec 2026 - Tip
import { format } from "dates";An HTML import map lets your scripts import a library by a short nameWrite import statements without long URLs and without a build step.1 Dec 2026 - Tip
async function sha256(text) {The Web Crypto API makes a SHA-256 hash right in the browserFingerprint text or a file in the page without adding a library.1 Dec 2026 - Tip
url = URL.createObjectURL(file);URL.createObjectURL previews a chosen photo before any web uploadShow the picked image at once, without sending it to a server first.1 Dec 2026 - Tip
function setFilter(name, value) {History.replaceState keeps web page filters in the address barMake a filtered view shareable without adding a history entry per click.1 Dec 2026 - Tip
const text = '{"createdAt":"2026-11-30T09:00:00Z","name":"x"}';A JSON.parse reviver turns date strings back into real Date objectsConvert dates once while parsing instead of all over your code.1 Dec 2026 - Tip
npm cache verifynpm cache verify checks and tidies npm's download cacheCheck the package cache for damage and clear out unneeded data safely.1 Dec 2026 - Tip
define( 'CONCATENATE_SCRIPTS', false );Set CONCATENATE_SCRIPTS false in wp-config when the admin looks brokenLoads admin scripts one by one so you can find the failing file.1 Dec 2026 - Tip
npm config listnpm config list shows which config file set each npm optionSee the active npm settings grouped by the file they come from.1 Dec 2026 - Tip
const observer = new ResizeObserver((entries) => {ResizeObserver tells you when an element changes size, not only the windowReact to an element's own width changes, from a sidebar toggle or new content.30 Nov 2026 - Tip
const form = document.querySelector("#settings");Fieldset disabled switches off every field in a form at onceDisable a whole group of inputs while a form is being sent, with one attribute.30 Nov 2026 - Tip
URL.parse("not a url"); // nullURL.parse() returns null for a bad URL, so you can drop the try/catchValidate and resolve URLs without exceptions in your normal code path.30 Nov 2026 - Tip
shareButton.addEventListener("click", async () => {Navigator.share() opens the phone's own share sheet from a buttonLet visitors share a page to any app they have installed, with a fallback for desktops.30 Nov 2026 - Tip
if (!name) throw new Error("No name given"); // sync throwPromise.try() turns a sync throw into a rejected promiseHandle errors from functions that might be sync or async in one catch.30 Nov 2026 - Tip
list.addEventListener("click", (event) => {Event.target.closest() makes one click listener handle a whole listOne listener on a parent handles clicks on items that are added later.30 Nov 2026 - Tip
const regions = new Intl.DisplayNames(["nl"], { type: "region" });Intl.DisplayNames gives country, language and currency names in any languageTurn codes like DE or EUR into readable names without a translation file.30 Nov 2026 - Tip
// 1st 2nd 3rd 4th 11th 12th 21st 22ndIntl.PluralRules picks 1 file or 2 files, and 1st, 2nd and 3rdChoose the right plural or ordinal suffix for a number without if statements.30 Nov 2026 - Tip
const collator = new Intl.Collator("en", { numeric: true, sensitivity: "base" });Intl.Collator with numeric: true sorts img2 before img10Natural sort order for file names and versions, ignoring upper and lower case.30 Nov 2026 - Tip
const signal = AbortSignal.any([AbortSignal.any() stops a fetch on a timeout or a cancel button, whichever comes firstCombine several abort reasons into one signal for fetch or any other API.30 Nov 2026 - Tip
function* naturals() {Iterator helpers like filter() and take() work on generators without making an arrayMap, filter and limit any iterator lazily, even an endless one.30 Nov 2026 - Tip
// Map { "jpg" => ["a.jpg", "c.jpg"], "png" => ["b.png"] }Map.getOrInsert() reads a key or stores a default in one callGroup or count items in a Map without the has, set, get dance.30 Nov 2026 - Tip
delete item.dataset.status; // removes the attributeElement.dataset reads data-* attributes as camelCase propertiesStore small bits of state in the markup and read them without getAttribute.30 Nov 2026 - Tip
const observer = new MutationObserver((mutations) => {MutationObserver runs your code when other scripts change the pageDetect added, removed or changed elements without polling the DOM.30 Nov 2026 - Tip
// submit when the user presses Ctrl+Enter in the textareaForm.requestSubmit() submits from a script and still runs validationScript-triggered submits check required fields and fire the submit event, unlike submit().30 Nov 2026 - Tip
const start = Temporal.PlainDate.from("2026-01-31");Temporal.PlainDate does date math without the time zone bugs of DateAdd months and count days between calendar dates, without midnight and DST surprises.30 Nov 2026 - Tip
let lock = null;Navigator.wakeLock keeps the screen on for a recipe or a timerStop a phone from dimming while someone follows steps on your page.30 Nov 2026 - Tip
const text = "👍🏽 ok 🇳🇱";Intl.Segmenter counts characters the way people see them, emoji includedGet a real character count for limits and truncation, where string length is wrong.30 Nov 2026 - Tip
const dark = window.matchMedia("(prefers-color-scheme: dark)");MatchMedia() with a change listener follows dark mode while the page is openReact in a script when the visitor switches between light and dark mode.30 Nov 2026 - Tip
const query = "1.5 (beta)?";RegExp.escape() makes user input safe to put inside a regular expressionSearch for literal text such as 1.5 (beta)? without the dots and brackets acting as regex syntax.30 Nov 2026 - Tip
const safe = Object.fromEntries(Object.fromEntries() turns key-value pairs back into an objectBuilds a plain object from an array or Map of key-value pairs, handy after filtering entries.28 Nov 2026 - Tip
const data = await Promise.any([Promise.any() takes the first promise that succeeds and ignores failuresResolves with the first promise that succeeds and only fails when all of them fail.28 Nov 2026 - Tip
const arr = [1, 2, 3, 4, 5];Array.with(index, value) replaces one item without changing the originalReturns a copy of an array with one index replaced, so the original stays unchanged.28 Nov 2026 - Tip
const controller = new AbortController();Pass an AbortController signal to addEventListener to remove listeners in one callRemoves several event listeners at once by aborting a shared AbortController signal.28 Nov 2026 - Tip
const foo = Object.create(null);Object.hasOwn(obj, key) replaces obj.hasOwnProperty(key)Checks whether an object has its own key, even for objects without a prototype.28 Nov 2026 - Tip
options.duration ??= 100;??= sets a default only when a value is null or undefinedAssigns a default value only when the variable is null or undefined, keeping 0 and empty strings.28 Nov 2026 - Tip
"192.168.1.10".replaceAll(".", "-");ReplaceAll() replaces every match without a regexReplaces every occurrence of a string in one call, with no regex escaping.28 Nov 2026 - Tip
test("async tests work too", async () => {Node --test runs your tests without installing a test frameworkRuns tests with the test runner built into Node, no extra package needed.28 Nov 2026 - Tip
npm explain globnpm explain shows why a package is in node_modulesShows the chain of dependencies that caused a package to be installed.28 Nov 2026 - Tip
console.time("fetchData");Console.time() and timeLog() measure how long a piece of code takesPrints how long code took between two labelled console calls.28 Nov 2026 - Tip
const a = [5, 4, -3, 20, 17, -33, -4, 18];FlatMap() maps and filters in one passMaps an array and drops or adds items in one pass by returning arrays.28 Nov 2026 - Tip
// for example "28 november 2026 om 14:05"Intl.DateTimeFormat with dateStyle gives Dutch dates without a libraryFormats dates and times in Dutch or any locale with the built-in Intl object.28 Nov 2026 - Tip
const re = /(?<year>\d{4})-(?<month>\d{2})/g;MatchAll() with named groups pulls every match out of a stringReturns every regex match including capture groups, readable with named groups.28 Nov 2026 - Tip
async function* pages() {Array.fromAsync() collects an async iterable into an arrayWaits for an async iterable or list of promises and returns a normal array.28 Nov 2026 - Tip
'cart total', total, items.lengthChrome DevTools logpoints log a value without editing your codePrints a message to the Console each time a line runs, without pausing the page.28 Nov 2026 - Tip
Elements > right-click #results > Break on > Subtree modificationsBreak on subtree modifications finds the script that changes an elementPauses the page in the script that adds, removes or changes an element.28 Nov 2026 - Tip
monitorEvents($0, 'click')MonitorEvents($0, 'click') logs the events of the element you inspectedLogs the events fired on the element you last inspected, straight from the Console.28 Nov 2026 - Tip
getEventListeners($0)GetEventListeners($0) lists which handlers are attached to an elementShows every event listener registered on the element you just inspected.28 Nov 2026 - Tip
copy($$('a').map(a => a.href))Copy() in the DevTools console puts a result on your clipboardCopies the result of a console expression to the clipboard as text.28 Nov 2026 - Tip
console.table([...document.querySelectorAll('img')].map(i => i.src))DevTools Snippets keep your console code and run with Ctrl+EnterSaves JavaScript in DevTools so you can run it on any page with one shortcut.28 Nov 2026 - Tip
$$$('button')$$$ in the Firefox console selects elements inside the shadow DOMFinds elements by CSS selector in the Firefox console, including inside shadow DOM.28 Nov 2026 - Tip
/api/ordersAn XHR/fetch breakpoint in DevTools pauses when a request URL matches a stringPauses the debugger on the line that sends a request whose URL contains your text.28 Nov 2026 - Tip
Ctrl+Shift+F > AuthorizationCtrl+Shift+F in DevTools searches all the files a page has loadedFinds a piece of text in every file the page has loaded, from one search box.28 Nov 2026 - Tip
const cities = ["Leiden", "Delft", "Utrecht"];Intl.ListFormat joins lists the way the language doesJoins an array into a readable sentence list using the rules of a language.28 Nov 2026 - Tip
// in the tab where the user clicks "log out"BroadcastChannel lets your open tabs talk to each otherSends a message from one browser tab to all other open tabs of the same site.27 Nov 2026 - Tip
throw new Error("Could not load settings", { cause: err });New Error(message, { cause }) keeps the original error when you rethrowKeeps the original error attached when you catch it and throw a clearer one.27 Nov 2026 - Tip
const data = JSON.stringify({ path: location.pathname, seconds: timeOnPage });Navigator.sendBeacon() sends a last bit of data when a visitor leavesSends a small POST request reliably when a visitor leaves or hides the page.27 Nov 2026 - Tip
const { promise, resolve, reject } = Promise.withResolvers();Promise.withResolvers() gives you resolve and reject outside the promiseCreates a promise and hands you its resolve and reject functions to call later.27 Nov 2026 - Tip
new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(123456.789);JavaScript's Intl.NumberFormat formats euros and big numbers the local wayFormats prices and large numbers per language and currency, without your own string code.26 Nov 2026 - Tip
const observer = new IntersectionObserver((entries) => {JavaScript's IntersectionObserver tells you when an element scrolls into viewRuns code when an element enters the viewport, without listening to every scroll event.26 Nov 2026 - TipThe HTML <template> element holds markup that a script copies for each itemKeeps a block of HTML ready but hidden, so a script can copy it for each new item.26 Nov 2026
- Tip
[5, 12, 50, 130, 44].findLast((element) => element > 45);JavaScript's findLast() searches an array from the endFinds the last array item that matches a test, without reversing or copying the array.26 Nov 2026 - Tip
const rtf = new Intl.RelativeTimeFormat("nl", { numeric: "auto" });Intl.RelativeTimeFormat writes "3 days ago" in any languageFormats a number and a unit as relative time in a chosen language, without a library.25 Nov 2026 - Tip
button.addEventListener("click", async () => {Navigator.clipboard.writeText copies text, with rules about when it mayWrites a string to the clipboard from JavaScript, as long as the page and the moment are allowed.25 Nov 2026 - Tip
const results = await Promise.allSettled([Promise.allSettled waits for every promise, even the ones that failRuns several promises together and returns the outcome of each, without stopping at the first rejection.25 Nov 2026 - Tip
const params = new URLSearchParams({ q: "fiets reparatie", page: 2 });URLSearchParams builds and reads query strings without manual escapingParses and builds URL query strings, with encoding handled for you.25 Nov 2026 - Tip
node --watch index.jsnode --watch restarts your script when a file changesStarts a Node.js script in watch mode, so it restarts by itself each time you save a file it uses.25 Nov 2026 - Tip
npm cinpm ci gives a clean, reproducible install in CIInstalls exactly what the lockfile says, after wiping node_modules, so builds are the same every time.25 Nov 2026 - Tip
npm ls --depth=0npm ls --depth=0 lists only the packages you installed yourselfShows the top-level dependencies of a project without the long tree of dependencies below them.25 Nov 2026 - Tip
npm outdatednpm outdated shows which dependencies have newer versionsLists installed packages with their current, wanted and latest versions, without changing anything.25 Nov 2026 - Tip
Delete this item?The dialog element gives you a modal without a libraryOpens a real modal dialog with a backdrop, focus handling and Escape to close, using one HTML element.24 Nov 2026 - Tip
const items = ['a', 'b', 'c'];Array.at(-1) gets the last item without array.length – 1Reads an array item by index and counts from the end when the index is negative.24 Nov 2026 - Tip
const id = crypto.randomUUID();Crypto.randomUUID() creates a random ID without a packageReturns a random version 4 UUID from the browser's secure random generator.24 Nov 2026 - Tip
const files = [Object.groupBy() sorts an array into groups by a keyGroups the items of an array into an object, one array per key you compute.24 Nov 2026 - Tip
try {AbortSignal.timeout() gives fetch a timeout in one lineMakes a fetch request give up after a set number of milliseconds, without a controller and a timer.24 Nov 2026 - Tip
const sorted = names.toSorted();ToSorted() sorts an array without changing the originalReturns a new sorted array and leaves the array you started with as it was.23 Nov 2026 - Tip
const copy = structuredClone(original);StructuredClone makes a real deep copy of an objectMakes a full deep copy of a JavaScript object, including dates, maps and sets.19 Nov 2026
Network1
CSS1
Media1
Docker1
Posts2
Nothing matches.