Writing Javascript with basic logic is easy but building a highly efficient software product is no cake, You gotta use the best of the best practices while writing code and write highly efficient algorithms as well
Here are some Javascript hacks you can use to write certain cleaner and more efficient code.
1. Extract Unique Values from given entries
We can create a new array only with the unique values by using the Set object and the Spread operator.
2. Use length to resize an array
We can overwrite the length property on an array and resize or empty it.
To empty the array make length property 0
3. Convert a Multidimensional array to 1 Dimensional array with spread operator
4. Convert string to number with just + operator
Note:- Only works with strings which are numbers