These are a collection of tips and tricks you can use to improve the performance and readability of your code.
“Zipping” refers to taking the values in two arrays and combining them into a single array of value pairs.
We’re often extracting properties from an array of objects. With a higher-order function, this becomes more readable and easier to do.
We can use the value returned by Math.random() to get a random element from an array.
We can split an array in two based on a condition: matches go in the first array, everything else goes in the second.
We can combine filter and includes to find which elements exist in both of two given arrays.
We can turn arrays of absolute numbers into relative numbers. The largest value becomes 1, with the others calculated based on that largest value.
We can shallowly merge objects without having to type out all properties by hand.
When you don’t want to drag a full object through your code, you can pick just the properties you need using reduce.