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.
Returns the singular or plural form of the word based on the input number, using an optional dictionary if supplied.
JavaScript, String · Oct 22, 2020
Generates a random string with the specified length.
JavaScript, String · Oct 22, 2020
Converts the values of RGB components to a hexadecimal color code.
JavaScript, String · Nov 3, 2020
Let's have a look at how to check if a string contains a substring in JavaScript.
JavaScript, String · Jul 27, 2022
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.
JavaScript, String · Sep 14, 2022
Checks if a given string ends with a substring of another string.
JavaScript, String · Aug 1, 2022
Checks if a given string starts with a substring of another string.
JavaScript, String · Jul 31, 2022
Strings in JavaScript can be escaped in various ways. But what if you need to prevent a string from being escaped? Here's a handy trick for that.
JavaScript, String · Jun 17, 2021
Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.
JavaScript, Node · Sep 15, 2020
Adds special characters to text to print in color in the console (combined with console.log()
).
JavaScript, Node · Nov 3, 2020
Checks if a string contains a substring, case-insensitive.
JavaScript, String · Jul 28, 2022
Checks if the given string is an absolute URL.
JavaScript, String · Oct 20, 2020