Get the index of an array item in a JavaScript for...of loop
Did you know you can get the index of an array item in a JavaScript for...of loop? Learn how with this bite-sized tip.
Finding ways to improve and optimize your code takes a lot of time, research and energy. Level up your coding skills one step at a time with this collection of quick tips and tricks.
Did you know you can get the index of an array item in a JavaScript for...of loop? Learn how with this bite-sized tip.
Calculate the ranking of an array based on a comparator function in JavaScript.
Ever needed to convert a NodeList
to an array in JavaScript? Here's the fastest way to do so.
Quickly and easily replace or append a value in a JavaScript array.
Implement the Luhn Algorithm, used to validate a variety of identification numbers.
Ever wanted to get the value of an HTML input element as a number? Learn an easy way to do it with this handy trick.
A simple trick to remove one or more attributes from an HTML element.
Learn how to merge two arrays of objects, while combining objects based on a specified key.
Did you know you can define an iterator for any JavaScript value? This quick tip will show you how.
Learn how to use regular expressions to replace the last occurrence of a pattern in a JavaScript string.
Learn how to change the lightness component of an hsl()
color string using JavaScript.
ESLint is a really useful tool, but sometimes it gets in the way. Learn how to refactor code to get rid of a common warning.
SDBM is a simple, non-cryptographic hash function that can hash strings into whole numbers. Here's a JavaScript implementation.
Learn how to resolve promises one after another (sequentially) in JavaScript.
Roman numerals are often used for stylistic reasons, but converting an integer to a roman numeral can be a bit tricky.
Learn how to convert a 3-digit RGB notated hexadecimal color-code to the 6-digit form.
Learn how to create a string with uppercase characters converted to lowercase and vice versa.
Efficiently check if a numeric array is sorted in ascending or descending order in JavaScript.
Easily create a debounced function that returns a promise.
Learn how to leverage Intl.ListFormat
to join an array into a string, with appropriate separators.
Have you ever wanted to serialize an object but only include certain keys? Turns out JavaScript provides an easy way to do this!
Create an array of partial sums, using Array.prototype.reduce()
and Array.prototype.slice()
.
Create a generator function that finds all the indexes of a substring in a given string.
Immutability is a fundamental concept you should be familiar with when learning functional programming.