These are a collection of tips and tricks you can use to improve the performance and readability of your code.
We can use the ternary operator in places where doing the same thing with if-else-branches would take a lot more code.
We can skip the arrow function when we pass the iterator in filter and map through to a second function.
Destructuring lets us extract an object’s property into a variable of the same name in very little code.
We can provide default values for variables in a way that respects “real” values that are still falsy.
If a switch-statement only serves to map a key to a value, we can use an object to do the same in fewer lines of code.
Are you calling the same function many times with near-identical parameters? Hide that repetition in a higher-order function for more readability.
When is June the fifth month of the year? When JavaScript is involved, of course. In JavaScript, January is the zero-th month.
The ternary operator isn’t limited to assigning values based on a condition. It also lets us switch between two near identical function calls.