Join URL segments
Joins all given URL segments together, then normalizes the resulting URL.
The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
Joins all given URL segments together, then normalizes the resulting URL.
Learn how to capitalize the first letter of a string in JavaScript using array destructuring and String.prototype.toUpperCase()
.
Email address validation can be much trickier than it sounds. Here's why and my advice on how to approach this problem.
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
Learn how to replicate the behavior of Array.prototype.map()
for strings.
Learn how to remove accents from a string in JavaScript, quickly and efficiently.
Converts a 2D array to a comma-separated values (CSV) string.
Regular expressions are a very useful tool. Save this cheatsheet for when you need to look up their syntax and speed up your development.
String splitting and truncation, both simple and locale-sensitive are possible in JavaScript. Learn how in this guide.
Quickly and easily check if a string is a yes/no answer to a boolean question in your CLI programs.
Learn how to effectively use JavaScript regular expressions with these 6 powerful features.
A short guide on how to correctly construct a URL in JavaScript.
Get all the partial substrings of a string in JavaScript using generator functions.
Avoid the naive approach and use a more robust method to edit URL parameters in JavaScript.
Use JavaScript to generate a random alphanumeric string of a specified length.
Checks if the a value is an empty object/collection, has no enumerable properties or is any type that is not considered a collection.
Here's a quick tip on how to compare and sort arrays of strings, ignoring case and accents.
Converts a comma-separated values (CSV) string to a 2D array.
Encode and decode strings with Base64 in JavaScript easily with these code snippets.
Gets the current URL without any parameters or fragment identifiers.
Use a regular expression to check if a string contains only alpha or alphanumeric characters in JavaScript.
Converts a number in bytes to a human-readable string.
Gets the size of an array, object or string.
Test if a string's start or end partially matches another string.