Tags » javascript
-
TIL:
console.log()
holds a reference to an object, not a copy of itWhen you view an array/object with
console.log()
, you see the contents at the time you expand it, not as it existed when you calledconsole.log()
. -
Localising the
<time>
with JavaScriptI’m using the
<time>
element and some JavaScript to display timestamps as human-readable, localised timestamps. Something likeTue, 15 Apr 2025 at 20:45 BST
is easier to read than2025-04-15T19:45:00Z
. -
TIL: Disable JavaScript in an
<iframe>
by setting thesandbox
attribute -
Making alt text more visible
I wrote a JavaScript snippet that shows alt text below all of my images, so I can see when it’s missing, and review it while I’m editing.
-
TIL: Sort a list of DOM elements by sorting and calling
appendChild()
-
TIL: Use Unicode property escapes to detect emoji in JavaScript
-
Preserving Dates during JSON serialisation with vanilla JS
How to make sure you get a
Date
back when you callJSON.parse
andJSON.stringify
. -
Testing JavaScript without a (third-party) framework
The browser can be a pretty good place to run your JavaScript tests.
-
CSS formatting in the console
Did you know you can use
%c
to format yourconsole.log
messages? -
Getting an Important Internet Checkmark to follow your cursor
Party like it’s 1996! A trailing checkmark cursor will make your Brand Website feel fun and authentic.
-
Redacting sensitive query parameters with koa and koa-logger
Using a custom transporter to modify the log message and remove secret information.
-
A simple gallery plugin for Obsidian
Making it easier to find all the images in my Obsidian vault.
-
Finding redundant data in our Next.js props
A script that helps us optimise our
__NEXT_DATA__
, which in turn helps reduce page size. -
An editing toolbar for alexwlchan.net
A bookmarklet that gives me a just-for-me toolbar to make changes to this site.
-
Remembering if a <details> element was opened
A JavaScript function that remembers if a details element was reopened, and keeps it open when you reload the page.
-
Showing human-friendly dates in JavaScript
What’s a nicer way to show a date than an ISO 8601 timestamp?
-
TIL: Manipulating URL query parameters in JavaScript
-
Adding checkboxes to lists
A bookmarklet to add checkboxes to lists in the browser.