Split a JavaScript string into words
Learn how to split a string into words, using the Intl.Segmenter API.
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 split a string into words, using the Intl.Segmenter API.
Learn how to leverage Intl.ListFormat to join an array into a string, with appropriate separators.
Learn how to create a generator function that keeps producing new values as long as the given condition is met.
Convert the data from an HTML form into a JavaScript object or serialize it into a query string.
Learn how to work with HTML element classes in JavaScript, from simple class checks to adding, removing and toggling classes.
Convert between a query string and its object representation in JavaScript.
Find the nth or every nth element of a JavaScript array.
Iterate over all own properties of an object, running a callback for each one.
Ever wanted to sort an array of objects, but felt like it was too complex? Here's a robust solution for just that.
Map the values of an array to an object, using the given mapping functions.
Learn how to transform objects by filtering their properties based on an array of keys or a predicate function.
Learn how to programmatically copy text to clipboard with a few lines of JavaScript and level up your web development skills.
Check if any or all the elements in an array are included in another array.
Learn how to parse or serialize a cookie with JavaScript, quickly and effectively.
I hand picked 25 of my favorite CSS gradients from uiGradients for your next design. Get them now!
Check if localStorage or sessionStorage is enabled in the browser, using a simple JavaScript function.
Learn how to implement array zipping, a grouping of elements based on position in the original arrays, and its inverse, unzipping.
Convert all the keys of an object to upper or lower case.
Determine if the current JavaScript environment is Node.js or a browser.
Group array elements into two or more arrays arrays, depending on the provided function's return value.
Learn how to get elements from the start or end of a JavaScript array by condition, using Array.prototype.slice().
Convert a date to extended ISO format (ISO 8601), including timezone offset.
Calculate the date of n days ago from today or the date of n days from now.
Easily convert between a JavaScript Date object and a Unix timestamp.