Node REPL, No Preview

After version v12.17.0, Node’s REPL provides a useful preview effect. In this example, 2 is shown in gray before I hit enter. > 1 + 1 2 But what if I don’t want that? Here’s a file called repl that disables it as an option: #!/usr/bin/env node const repl = require('node:repl'); repl.start({preview: false}); Then: $ ./repl > 1 + 1 No preview. Docs

June 2, 2026 · 1 min · Jake Worth

NVM Install and Use Latest LTS

With my Node versions managed via NVM, I want to be on the latest LTS. You can ensure that happens with these commands: $ nvm install --lts $ nvm alias default lts/* default -> node (-> v24.16.0) ...

May 29, 2026 · 1 min · Jake Worth

JavaScript Wraparound Index

What I call “wraparound” are repeatable indices on an array. The common use case is a carousel. Here’s how it’s done: const items = ["first", "middle", "last"]; const i = 0; // Our iterable index // "Next" -> const nextIndex = (i + 1) % items.length; // <- "Previous" const prevIndex = (i - 1 + items.length) % items.length;

May 7, 2026 · 1 min · Jake Worth

JavaScript String Concatenation

Here’s a periodic reminder that JavaScript supports string concatenation with a plus sign: > 'foo' + 'bar' 'foobar' ...

May 6, 2026 · 1 min · Jake Worth

JavaScript Spread a String Into An Array

Need an array of letters? Here’s a trick: > const alpha = [...'abcdefghijklmnopqrstuvwxyz'] ...

May 5, 2026 · 1 min · Jake Worth

JavaScript Array Join Comma Default Separator

When you join an array in JavaScript, the default separator is a comma: node> ['j', 'a', 'k', 'e'].join() 'j,a,k,e' ...

May 5, 2026 · 1 min · Jake Worth

JavaScript Bitwise AND

The JavaScript bitwise AND operator (&) can be used for some real-world tasks, like testing if a number is odd or even. ...

May 1, 2026 · 1 min · Jake Worth

Initialize With npm init

Most JavaScript projects come with a package.json. But what if you want to make a new one? ...

February 12, 2026 · 1 min · Jake Worth

Writing the DOM with fs

How can I output the entire DOM to a file in a JavaScript test? ...

January 30, 2026 · 1 min · Jake Worth

Rebuilds on Write With Nodemon

I’ve been hacking on a TypeScript file all day, but I need transpiled JavaScript for any testing. How did I reduce cycle time (and mitigate many chances to forget to build at all)? ...

December 30, 2025 · 1 min · Jake Worth