30秒学会 JavaScript 片段 – Pad number
Pads a given number to the specified length. Use String.prototype.padStart() to pad the number to sp...
Pads a given number to the specified length. Use String.prototype.padStart() to pad the number to sp...
Up until a few years ago, the go-to method for splitting a string into words was String.prototype.sp...
Returns the length of a string in bytes. Use str.encode() to encode the given string and return its ...
Checks if a string contains a substring, case-insensitive. Use the RegExp constructor with the ‘i’ f...
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation an...
Converts a color code to an rgb() or rgba() string if alpha value is provided. Use bitwise right-shi...
Checks if a string contains only alphanumeric characters. Use RegExp.prototype.test() to check if th...
Converts an hsl() color string to an object with the values of each color. Use String.prototype.matc...
By default, when JavaScript sees an escape character (\), it will escape the character after it. How...
Creates a string with uppercase characters converted to lowercase and vice versa. Use the spread ope...