Understanding event bubbling, capturing and delegation in JavaScript
Understand how events work in JavaScript and learn when to use event bubbling, event capturing and event delegation with this short guide.
30 seconds of code provides a curated collection of short code snippets for all your development needs. Our collection spans many topics, ranging from simple coding problems to theoretical concepts and development techniques.
Understand how events work in JavaScript and learn when to use event bubbling, event capturing and event delegation with this short guide.
Sort an array of numbers, using the heapsort algorithm.
Ever needed to convert a NodeList
to an array in JavaScript? Here's the fastest way to do so.
Learn how you can compare two objects in JavaScript using various different techniques.
Not sure if you need to prefix a CSS property in order to use it? Here's a simple way to figure it out!
Quickly and easily replace or append a value in a JavaScript array.
Chunk an array or iterable into arrays of a specified size or a given number of chunks.
Dynamically loads an external script.
Creates a card that displays additional content on hover.
A short, opinionated CSS reset to make your websites look great everywhere.
Learn how to shuffle, sample and perform weighted selection on JavaScript arrays.
JavaScript arrow functions are a very useful tool to learn and master. Here's a complete introduction to everything you need to know.
Learn everything you need to know about promises and asynchronous JavaScript with this handy cheatsheet.
Sort an array of numbers, using the bucket sort algorithm.
The Caesar cipher is a simple substitution cipher, which can be easily implemented with a few lines of JavaScript code.
Learn how to calculate date difference in seconds, minutes, hours, days etc. in vanilla JavaScript.
If you need to check if Caps Lock is on when the user is typing in the browser, JavaScript's got you covered.
Closures are used frequently, yet often misunderstood. Understanding them in depth is crucial to be able to write clean, maintainable code.
Implement the Luhn Algorithm, used to validate a variety of identification numbers.
Sort an array of numbers, using the quicksort algorithm.
Sort an array of numbers, using the selection sort algorithm.
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.
Implements fetch()
in a declarative manner.
Checks if the code is running on the browser or the server.