Compute the difference between two JavaScript arrays→
Assume we have two JavaScript arrays, alpha
and bravo
. We need to determine which items appear in alpha
, but not in bravo
.
Assume we have two JavaScript arrays, alpha
and bravo
. We need to determine which items appear in alpha
, but not in bravo
.
By default, a Node.js stream expects to operate on a Buffer
or a Uint8Array
. We can override this by telling the stream to use "object mode".
When working on a codebase with a lot of unstaged or untracked changes, the default git status
output is unhelpful.
Typing clear
at a command prompt clears the screen. Simple enough. Unfortunately, it's no help if you're inside a REPL, or a long-running process.
If you're accustomed to PHP's logical operators, JavaScript's implementation can be confusing.
Avoid Array.prototype.push
. It modifies the array in place, which is asking for trouble. It also returns the array length, not the modified array, which is plain confusing.
Using the Vim extension for Visual Studio Code? Here's how to quickly find files and folders in the Explorer.
JSON Schema is a very useful tool for validating API requests. Sadly it's not immune to the quagmire of pedantry that is URL validation.
The default "recurse depth" of console.dir
is 2. This is rarely what I want.
Faker is a useful JavaScript library for generating dummy data. For example, faker.random.words(3)
generates a string containing three random words. But what if you want to generate an array of random words?