JavaScript String Concatenation
Here’s a periodic reminder that JavaScript supports string concatenation with a plus sign: > 'foo' + 'bar' 'foobar' ...
Here’s a periodic reminder that JavaScript supports string concatenation with a plus sign: > 'foo' + 'bar' 'foobar' ...
Need an array of letters? Here’s a trick: > const alpha = [...'abcdefghijklmnopqrstuvwxyz'] ...
When you join an array in JavaScript, the default separator is a comma: node> ['j', 'a', 'k', 'e'].join() 'j,a,k,e' ...
The JavaScript bitwise AND operator (&) can be used for some real-world tasks, like testing if a number is odd or even. ...
Most JavaScript projects come with a package.json. But what if you want to make a new one? ...
How can I output the entire DOM to a file in a JavaScript test? ...
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)? ...
Suppose your package.json specifies a Node engine of greater than or equal 24. Does this mean all engineers on your team will use Node 24? No, unless you use this one weird trick! ...
Want to learn a tricky topic and sharpen your learning skills at the same time? In this post, I’ll use the Feynman Learning Technique— a method of learning complex things by explaining them simply— with a sprinkle of LLM magic, to deepen my understanding of JavaScript promises. ...
The Node REPL has its own editor: node > .editor // Entering editor mode (Ctrl+D to finish, Ctrl+C to cancel) const increment = (array) => array.map(item => item + 1) increment([1,2,3]) Exit and evaluate with Ctrl+D: [ 2, 3, 4 ] I’d use this to experiment with JavaScript API’s without leaving my terminal-based IDE.