Kent C. Dodds’ .filter() Trick Will Change How You Use JavaScript | by Dr. Derek Austin 🥳 | Coding at Dawn | Jun, 2021 | Medium
Kent C. Dodds’ .filter() Trick Will Change How You Use JavaScript. This one-liner uses the Boolean constructor to magically remove all falsy values from an array ✨.
https://twitter.com/kentcdodds/status/1009918457394225152
const plugins = [
isProd ? optimizePlug : null,
isProd ? prodOnlyPlug : null,
!isProd ? testingPlug : null,
usefulPlug,
].filter( Boolean );
July 9, 2021 at 9:31:51 AM EDT
*
FILLER