Iterating through an array of objects to find a specific one.
Miscellaneous
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.
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.
Transform all text in a string to lowercase
Use String.toLowerCase() to transform all text in a string to lowercase.
Check if an Item Exists in an Array
Instead of using the indexOf() method to check if an element is in the array, you can use the includes() method.
Return all the elements of an array except the last one
Use Array.prototype.slice(0, -1) to return all but the last element of the array.
Show a loading indicator when an iframe is being loaded
This post demonstrates a common case where we show a loading indicator while an iframe is being loaded.
Remove leading and trailing whitespace from a string
Remove leading and trailing whitespace from a string.