Where and how can I use the Boolean function in JavaScript?
JavaScript's Boolean function can be used for truth-checking data among other things. Learn how to use it and level up your code today.
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.
JavaScript's Boolean function can be used for truth-checking data among other things. Learn how to use it and level up your code today.
Learn how to split a JavaScript array into two groups based on a function or an array of values.
Oftentimes you might need to add a timeout to a promise in JavaScript. Learn how to do this and more in this short guide.
Learn how to perform function composition for asynchronous functions.
Learn how you can compare two arrays in JavaScript using various different techniques.
Learn how to manipulate Date
objects to add minutes, hours, days and more.
Learn how to create an isometric card using CSS.
Ever wanted to force update a React component? Here's a custom hook that does just that.
Observe visibility changes for a given element, using the IntersectionObserver
API.
Learn how to create a string with uppercase characters converted to lowercase and vice versa.
JavaScript's promises represent the eventual completion (or failure) of asynchronous operations and their resulting value.
Use some clever JavaScript tricks to listen for and handle scroll stop events in the browser.
Learn how to write a JSON object to a file, both using Node.js and in the browser.
Learn how to join the segments of a URL and normalize the resulting URL using JavaScript.
Learn how to invert the key-value pairs of an object in JavaScript.
Learn how to transform objects by filtering their properties based on an array of keys or a predicate function.
Calculate the factorial of a number, using two different approaches.
Learn how to convert a 3-digit RGB notated hexadecimal color-code to the 6-digit form.
Using the Proxy object, we can create dynamic getters and setters for objects in JavaScript.
Assign default values for all properties in an object that are undefined
.
Given a value, find out how many times it appears in an array or string.
A collection of regular expressions that can be used to solve common problems.
JavaScript doesn't have a built-in way to check if a value is blank, but it's easy to create one.
Which method do you reach for first? What are the differences between them? Let's find out!