The increment operator (++) adds 1 to its operand and returns a value. Similarly, the decrement operator (–) subtracts 1 from its operand and returns a value. Both of these operators can be used either prefix (++i, –i) or postfix (i++, i–). If used prefix, the value is incremented/decremented, and the value of the expression is the updated value. If used […]
Return an array of keys from an object. Pass in the object as an argument. Source https://vanillajstoolkit.com/reference/objects/object-keys/
Get the index of the first matching item in an array. Returns -1 if no matching item is found. Source https://vanillajstoolkit.com/reference/arrays/array-indexof.md/
You can sort arrays of objects. In this case we leverage the collator.compare method and pass along the properties that we want to sort by. Source https://elijahmanor.com/byte/js-locale-sort
This code adds special characters to text to print in color in the console (combined with console.log()). Use template literals and special characters to add the appropriate color code to the string output. For background colors, add a special character that resets the background color at the end of the string. Source https://www.30secondsofcode.org/js/s/colorize
Combine all items in an array into a string, separated by a delimiter that you can pass in as an argument. By default, it will use a comma (,) as the delimiter if one is not provided. Source https://vanillajstoolkit.com/reference/arrays/array-join/
Use Array.prototype.reduce() to increment a counter each time the specific value is encountered inside the array. Source https://www.30secondsofcode.org/js/s/count-occurrences
Two ways to capture the right click on a mouse.