David Walsh Tutorials
Array.prototype.at
Working with arrays is an essential skill in any programming language, especially JavaScript, as we continue to rely on external data APIs. JavaScript has added methods like
find
and `findIndex
recently, but one syntax I love from languages like Python is retrieving values by negative indexes.When...Fast, Accurate Geolocation Data with IPWHOIS.io
In the world of marketing and content targeting, having accurate geolocation data can be the difference between a thriving enterprise and a floundering business. Accurate data is everything, especially in the targeted marketing. When you need trustworthy geolocation data, IPWHOIS.io is a great...
Command Line trash
One of the first commands you learn when experimenting with command line is
rm
, the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a "Trash" paradigm, where files are stored before truly deleted. With the...Terminate Process on a Port from Command Line
Once a week I have to deal with a zombie process or try to start a process that's already running on its designated port. In most cases I use macOS's Activity Monitor to kill the process, which is time-consuming. What if we could just...
CSS accent-color
For better or worse, form fields have been somewhat difficult to style with CSS. Form control display is dependent upon device, operating system, and browser, so you can imagine the difficulty in making styling easy. We have slowly been given some controls over form control...
How to Create a UUID in JavaScript
The UUID identifier has been used in programming since the days a baby-faced David Walsh became a professional software engineer. My first exposure to UUIDs was via a ColdFusion app I inherited and ... the less we say about that the better. In any...
AggregateError
One of the big themes of the web these days is concurrency, which leads to accomplishing tasks asynchronously. In doing so, the possibility of multiple errors can occur. Instead of providing a generic error, optimally you'd provide a wealth of error information. The
AggregateError
...jq for JSON
I old enough to remember when we thought XML was going to change the programming world...then JSON saved us from that hell. Parsing and querying JSON data is fundamental task we've all coded for, but sometimes I just want to get some data locally with minimal...
React usePrevious Hook
Hooks are essential for the functional component pattern in React. One frequent logic comparison with
class
components was comparing a previousprop
value with a currentprop
value via lifecycle methods. So what's an easy pattern for duplicating previous value comparisons in functional components?TheuseRef
and...Set a Default Node Version with nvm
As I've shown you in the past,
nvm
an excellent utility for switching between Node.js versions. Whether your host machine or CI, building and testing your apps on different Node versions is a necessity. I've recently found a fewnvm
commands that I found really...