Dynamic shadow
Learn how to create a shadow similar to box-shadow
, but based on the colors of the element itself.
30 seconds of code contains a curated collection of code articles covering a wide range of development needs. The collection spans many topics, ranging from simple coding problems to theoretical concepts and development techniques.
Learn how to create a shadow similar to box-shadow
, but based on the colors of the element itself.
Learn how to create a unit converter data structure in JavaScript that can convert between any compatible units.
Trailing commas are not without controversy. Here's why I think you should use them.
Create an array of partial sums, using Array.prototype.reduce()
and Array.prototype.slice()
.
Sort an array of numbers, using the merge sort algorithm.
Have you ever wanted to serialize an object but only include certain keys? Turns out JavaScript provides an easy way to do this!
Learn how to leverage Intl.ListFormat
to join an array into a string, with appropriate separators.
Learn how to check if a number is prime and how to generate prime numbers up to a given number in JavaScript.
Learn how to initialize a 2D array in JavaScript in a handful of different ways.
Group the elements of an array based on the given function, producing an object with the grouped values.
Learn how to retrieve and manipulate the styles of an HTML element easily and efficiently with JavaScript.
Learn how to add an event listener that is executed at most once.
Use JavaScript's Math.hypot()
to calculate the Euclidean distance between two points.
Easily create a debounced function that returns a promise.
Explore how you can apply mathematical set operations to JavaScript Set
objects and arrays.
Efficiently check if a numeric array is sorted in ascending or descending order in JavaScript.
A few tips and tricks to help you filter arrays in JavaScript more efficiently.
Learn all you need to know about Git stashing, including how to stash changes, apply, list, and delete stashes.
Increase your productivity and reduce your cognitive load by creating aliases for many common git operations.
Hide an element completely (visually and positionally) in the DOM while still allowing it to be accessible.
Make sure the footer stays at the bottom of the page, instead of floating up when the content is too short.
Create a portal, allowing rendering of children outside the parent component, with this custom hook.
Wrap a string to a given number of characters using a string break character in JavaScript.
Learn how to work with arrays of numbers in JavaScript, performing common math operations such as sum, average, product and more.