Two ways to capture the right click on a mouse.
Reverse the order of items in an array
Reverse the order of items in an array. Source https://vanillajstoolkit.com/reference/arrays/array-reverse/
Return every nth element in an array
Use Array.prototype.filter() to create a new array that contains every nth element of a given array. Source https://www.30secondsofcode.org/js/s/every-nth
Determine whether two values are the same value
The Object.is() method determines whether two values are the same value.
Take the content of an array and return a single value
Take the content of an array and return a single value. That value can be anything: a string, number, object, or even another array.
Remove whitespaces from a string
Returns a string with whitespaces removed. Use String.prototype.replace() with a regular expression to replace all occurrences of whitespace characters with an empty string.
Aliases with JavaScript Destructuring
There are cases where you want the destructured variable to have a different name than the property name.
Transform the items in an array and create a new one
Iterate through each item in an array, transform it, and return a new array.
Filter out matching array elements
Filters out the elements of an array that have one of the specified values.
Count elements in an array
Two ways to count the total number of the same elements in a single array.