Capitalize the first letter of a JavaScript string
Learn how to capitalize the first letter of a string in JavaScript using array destructuring and String.prototype.toUpperCase()
.
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.
Learn how to capitalize the first letter of a string in JavaScript using array destructuring and String.prototype.toUpperCase()
.
Implement the Levenshtein distance algorithm in JavaScript to calculate the difference between two strings.
Learn how to remove accents from a string in JavaScript, quickly and efficiently.
Email address validation can be much trickier than it sounds. Here's why and my advice on how to approach this problem.
Learn how to convert text into HTML-safe strings and vice versa using JavaScript.
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
Use JavaScript to generate a random alphanumeric string of a specified length.
Converts a 2D array to a comma-separated values (CSV) string.
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.
Get all the partial substrings of a string in JavaScript using generator functions.
Here's a quick tip on how to compare and sort arrays of strings, ignoring case and accents.
Use a regular expression to check if a string contains only alpha or alphanumeric characters in JavaScript.
Learn how to effectively use JavaScript regular expressions with these 6 powerful features.
Converts a comma-separated values (CSV) string to a 2D array.
Gets the current URL without any parameters or fragment identifiers.
Regular expressions are a very useful tool. Save this cheatsheet for when you need to look up their syntax and speed up your development.
Gets the size of an array, object or string.
A short guide on how to correctly construct a URL in JavaScript.
Avoid the naive approach and use a more robust method to edit URL parameters in JavaScript.
Encode and decode strings with Base64 in JavaScript easily with these code snippets.
Converts a number in bytes to a human-readable string.
If you need to replace all occurrences of a string in JavaScript, you have a couple of options.
Test if a string's start or end partially matches another string.