toggleClass toggles a class for an HTML element.
Drag and drop element in a list
Create a sortable list whose items can be dragged and dropped inside it.
Convert a string into an array
Convert a string into an array by splitting it after a specific character (or characters).
Check if the given string contains any whitespace characters
Use RegExp.prototype.test() with an appropriate regular expression to check if the given string contains any whitespace characters.
Create an image comparison slider
Create a slider for comparing two images visually. The slider has three elements.
Replace a portion of a string with something else
The replace() method accepts two arguments: the string to find, and the string to replace it with.
The Exponent Operator
Do you useMath.pow() to raise a number to a power? Did you know you can use the exponent operator ** as well?
Detect whether the page is being viewed on a mobile device or a desktop
Use a regular expression to test the navigator.userAgent property to figure out if the device is a mobile device or a desktop.
Create a range slider
This post introduces two popular ways to create a range slider.
Transform all text in a string to lowercase
Use String.toLowerCase() to transform all text in a string to lowercase.