These are a collection of tips and tricks you can use to improve the performance and readability of your code.
If you keep seeing stars in JavaScript, it’s probably someone trying to raise a number to the power of another number.
There are several ways to concatenate in JavaScript. We can pick the one that is most readable in each situation.
We can un-nest arrays with a native function now. We can also define how many levels of nesting we want to take out, to a maximum of “all levels”.
With the Fisher-Yates algorithm, we can shuffle an array with true randomness. The likelihood of two shuffles giving the same result is minimal.
We can create a helper function that makes functions return their Boolean opposite. This can be useful in the shorthand syntax for array methods.
Instead of splitting strings at sequences of characters, we can split them into substrings of equal length by using a regular expression.
By destructuring the return value of a function, we can take out only the values we need without having to assign the result to an object first.
To filter all falsy values from arrays, all we need to do is pass the Boolean constructor to the filter function.