Colorize text in the Node.js terminal
Use special Unicode characters to print text in color in the console.
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.
Use special Unicode characters to print text in color in the console.
Learn how to work with whitespaces in JavaScript strings, using these simple yet powerful regular expression techniques.
Returns a string of the form HH:MM:SS
from a Date
object.
Returns the singular or plural form of the word based on the input number, using an optional dictionary if supplied.
If you need to replace all occurrences of a string in JavaScript, you have a couple of options.
Use a regular expression to remove HTML/XML tags from a string.
Ever wanted to convert a tilde path to an absolute path? Here's how you can do it in JavaScript.
Replace all characters in a string, except for the ending characters, with a mask character.
Let's have a look at how to check if a string contains a substring in JavaScript.
Have you ever tried to convert the string representation of a boolean to an actual boolean value? Here's a simple way to do it.
Strings in JavaScript can be escaped in various ways. But how do you prevent a string from being escaped? Here's a handy trick for that.
Use these simple tricks to check if a string is uppercase or lowercase in JavaScript.
Checks if a string contains a substring, case-insensitive.
Checks if the given string is an absolute URL.
Learn how to easily convert any string to a URL-friendly slug, using regular expressions.
Removes non-printable ASCII characters.
Escapes a string to use in a regular expression.
Convert tabs to spaces, where each tab corresponds to count
spaces.
Normalizes line endings in a string.
Figure out the exact number of bytes in a JavaScript string, including Unicode characters.
Pads a string on both sides with the specified character, if it's shorter than the specified length
.
When it comes to immutability, JavaScript strings are often a source of confusion. Yet they're not as complicated as you might expect.
Indents each line in the provided string.