These are a collection of tips and tricks you can use to improve the performance and readability of your code.
Since array methods like filter and map return an array themselves, we can chain them one after the other.
We can build a dictionary of a string’s letters to count how many times each letter appears.
The default behavior of sorting arrays assumes every value is a string. That leads to unexpected behavior when working with numbers.
There is now a more convenient way than reduce or loops to check if all elements in an array match a condition.
By combining map and slice, we can write a helper function to split large arrays into many similarly sized blocks. This is useful for features like pagination.
We can reduce an array of numbers into a single value that represents the sum of its values, without needing a traditional for-loop.
This neat little trick makes values logged to the console much more readable with a minor adjustment to how we log it.
When creating Tailwind CSS-like utility classes, we can use Sass’ loops to save a lot of repetition.