This one-liner uses the Boolean constructor to magically remove all falsy values from an array ✨

I wanted to share a trick I picked up a few years ago from señor Kent C. Dodds, the “Epic React” and “Testing JavaScript” guy.

Did you find that example kind of convoluted? No worries, let’s break it down real quick, and then I’ll share why I filter Boolean values.


How I went from physical therapist to front-end software engineer and developer advocate.

My Journey from Physical Therapy to Engineering

You may be curious as to why a physical therapist, massage therapist, and strength coach is also an SEO & web performance expert.

Having spent the last decade in sports medicine, including several years as a full-time physical therapist (and Airbnb SuperHost who got over 500 reviews in 3 years), it was time for a change — so I started blogging on Medium to refresh my web development skills.

You see, I started building websites professionally back in 2001, and I even built a PHP app for LiveJournal that earned a few hundred dollars in advertising income. …


WEB PERFORMANCE

Google’s about to penalize slow websites. If you care about search engine optimization (SEO) and your ranking on Google, you should pay attention to this change in their search algorithm

Image: LCP (2.5–4sec) vs. FID (100–300ms) vs. CLS (0.1–0.25)
Image: LCP (2.5–4sec) vs. FID (100–300ms) vs. CLS (0.1–0.25)

I was cussing on the toilet, again, because I’d accidentally clicked a link on my phone while reading The Ringer’s NBA coverage.

My mom would be embarrassed, I’m sure.

You see, I prefer to open links from their website in a new tab, because I don’t want to hit the Back button. Why would such a minor thing cause me to start cussing in such a compromising position?

It’s because their website is slow. If I hit the Back button, I have to wait for their site to load again, and it almost always loses my place as dozens of…


The usual methods of copying an object or array only make a shallow copy, so deeply-nested references are a problem. You need a deep copy if a JavaScript object contains other objects.

What is a shallow copy?

Making a shallow copy of an array or object means creating new references to the primitive values inside the object, copying them.

That means that changes to the original array will not affect the copied array, which is what would happen if only the reference to the array had been copied (such as would occur with the assignment operator =).

A shallow copy refers to the fact that only one level is copied, and that will work fine for an array or object containing only primitive values.

For objects and arrays containing other objects or arrays, copying these objects requires…


Why they switched, how they migrated—and why they wouldn’t do it today

In early 2018, The Guardian, a British newspaper and online publication, switched its 2.3m content items from MongoDB to PostgreSQL.

Why did they switch? What would they do differently today?

The Day the London Servers Baked

In July 2015, a massive heatwave struck London, with the unusual consequence of The Guardian switching from MongoDB to PostgreSQL just three years later.

At the time, The Guardian’s data was in a standard NoSQL database; MongoDB stored locally at Guardian Cloud, the data center in the basement of The Guardian’s office near Kings Cross.

While writers for The Guardian were live-blogging about the heat, developers at The Guardian…


In fairness, Adam Wathan & Steve Schoger tried to warn me about this feature of Tailwind CSS’s “Just-in-Time” engine, but I still only caught this bug by accident. Don’t make my mistake!

Can you spot the bug in this React .jsx code using Tailwind CSS? 🐞


“Here I Go Again,” breaking down another convention in computer programming that you always wondered about.

I can’t stop laughing, because today I saw the funniest ESLint error message I’ve ever seen in my life. Take a look:


React 18’s new features will include performance improvements, being able to prioritize certain renders, and improved server-side rendering.

I’d been trying to ignore the React 18 news because Next 11 just came out, but thankfully abhinav anshul. wrote up a great post over on Dev.to about all the upcoming features planned for React 18. 🙏

There’s a lot to talk about, but we could easily spend 2 hours discussing all of the big new features, so let’s not do that. 😀

Here are the 3 things I’m most excited about in React 18, the next major version of React announced in June 2021. 🥳

1 — Automatic Batching in React 18

I like to nerd out about web performance and core web vitals because I…


Is it finally time to admit that JavaScript frameworks have some advantages over plain old vanilla JavaScript programming?

Next.js 11 arrived yesterday in the form of a major semantic version update dropped on a Tuesday morning, like you didn’t have anything else to work on this week at work.

The product announcement was delivered at Next.js Conf, which was less of a conference and more of a 24-minute YouTube video.

Unlike Jamstack Conf, which was a virtual conference hosted on the HopIn platform that included tons of fun networking and vendor booths, Next.js Conf was more like attending the screening of a short film followed by a hang session on Discord.

Oh, and Vercel dropped exclusive merch benefiting…


WEB PERFORMANCE

Either method can work. Array.prototype.filter() is infinitely more powerful than Array.prototype.includes(), while the .includes() method is easier to read and offers much better performance.

If you need to know if a JavaScript array contains an item, you have a couple of options other than just writing a for loop.

The most obvious alternative is Array.prototype.includes(), but using Array.prototype.filter() might save you future refactoring.

“The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.”
MDN Docs

If you need to return the first matching item, you’d use Array.prototype.find() instead of .includes().

The more powerful .filter() method lets you test the entire array with an arbitrary criteria, and it returns a new array of all…

Dr. Derek Austin 🥳

Frontend Software Engineer ♦ Developer Advocate ♦ SEO & Web Performance Expert ♦ Content Writer ♦ My Favorite Tech Stack: React / Next.js at Vercel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store