These are a collection of tips and tricks you can use to improve the performance and readability of your code.
If an array contains flat values, we can turn them into objects where they become a property’s value.
Want to create annoying memes but are too lazy to hit the shift key every other letter? Don’t worry, I got you.
Yet another use for the ternary operator: only change the values in an array that match a condition.
Accessing deeply nested values required us to check for undefined along the way. With optional chaining, we no longer need to do that.
To quickly access all objects that share the same value for a property, we can group them by that property first.
An “XOR” operation returns the elements that only exist in one of two arrays, but not both.
Arrays can contain the same value many times, while sets cannot. We can filter an array to unique values by using this difference.
Until we get a native method on the array prototype itself, we can write a helper to get the last element in an array.