What are the differences between Maps and objects in JavaScript?
Maps and objects are very similar, but they have some differences that can help you decide which one better fits your use-case.
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.
Maps and objects are very similar, but they have some differences that can help you decide which one better fits your use-case.
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.
Function arity is a simple, yet useful concept in functional programming, especially when combined with currying.
Currying is a process that transforms a function that takes multiple arguments into a series of functions that each take a single argument.
JavaScript uses callback functions quite a lot. From event listeners to asynchronous code, they're an invaluable tool you need to master.
Learn everything you need to know about promises and asynchronous JavaScript with this handy cheatsheet.
Ever wanted to listen for multiple events on an element and handle them with the same function? Here's how!
Create a progress bar indicating the scroll percentage of the page, using CSS and JavaScript.
If you're transitioning from class components to functional components, you can replicate the behavior of lifecycle methods using hooks.
Chunk an array or iterable into arrays of a specified size or a given number of chunks.
Quickly and easily replace or append a value in a JavaScript array.
Not sure if you need to prefix a CSS property in order to use it? Here's a simple way to figure it out!
Ever needed to convert a NodeList
to an array in JavaScript? Here's the fastest way to do so.
Learn all of the options JavaScript provides for modifying the URL of the current page in the browser without reloading the page.
Sort an array of numbers, using the heapsort algorithm.
Understand how events work in JavaScript and learn when to use event bubbling, event capturing and event delegation with this short guide.
Leverage the Date
object to check if a given date is inside business hours.
Calculate the ranking of an array based on a comparator function in JavaScript.
Level up your event handling skills by learning how to attach or detach event listeners from multiple elements at once.
Wrapping your mind around React hooks and how they interact with setInterval()
can be difficult. Here's a guide to get you started.
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.
Sort an array of numbers, using the selection sort algorithm.
Sort an array of numbers, using the quicksort algorithm.
Learn how you can compare two objects in JavaScript using various different techniques.