Merge two or more JavaScript objects
Learn how to combine two or more objects into a single object in JavaScript.
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 combine two or more objects into a single object in JavaScript.
Create an array of n-tuples of consecutive elements from a given array.
Create a new array out of the two supplied by creating each possible pair from the arrays.
Ever wanted to convert a tilde path to an absolute path? Here's how you can do it in JavaScript.
Circular JSON objects can't be serialized using JSON.stringify(), but you can use this trick to handle them.
Use a simple JavaScript trick to validate a serialized JSON object.
Using an HTML element, you can easily make all links in your document open in a new tab. Learn how with this quick tip.
Learn how to shuffle, sample and perform weighted selection on JavaScript arrays.
Use JavaScript to generate a random alphanumeric string of a specified length.
Use a regular expression to remove HTML/XML tags from a string.
Combining Math.random() and a few simple math operations, you can generate an array of random integers in a specified range.
Use special Unicode characters to print text in color in the console.
A quick, one-liner to generate a random boolean value in JavaScript.
Leverage the Date object to check if a given date is inside business hours.
Roman numerals are often used for stylistic reasons, but converting an integer to a roman numeral can be a bit tricky.
Enhance JavaScript's Math.random() to generate a random number or integer in a specified range.
Generate the powerset of a given array of numbers or other primitive values.
Create a generator function that finds all the indexes of a substring in a given string.
Figure out the exact number of bytes in a JavaScript string, including Unicode characters.
Learn how to create a directory using Node.js, if it doesn't exist.
Easily convert an hsl() color string to an array of values or an object with the values of each color.
Easily convert an rgb() color string to an array of values or an object with the values of each color.
Learn how to easily convert between the various color formats, using JavaScript and a few simple formulas.
Learn how to compare the contents of two arrays to see if they contain the same elements regardless of order.