JavaScript String Methods

You are Here:

String Methods Demo

Hints

The above demo uses the following string methods.

  • string.toUpperCase() - to convert a string to uppercase letters.
  • string.toLowerCase() - to convert a string to lowercase letters.
  • string.split() - to split a string into an array of substrings.

List of String Methods

The following table provides a list of all string methods available in JavaScript.

MethodExplanation
charAt()Returns the character at the specified index
charCodeAt()Returns the Unicode of the character at the specified index
concat()Combine two or more strings and returns a new joined strings
endsWith()Checks whether a string ends with the characters of another string.
fromCharCode()Converts Unicode values to characters
includes()Checks whether a string contains the specified characters/string
indexOf()Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found
lastIndexOf()Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found
localeCompare()Compares two strings in the current locale
match()Used to match a regular expression against a string
repeat()Returns a new string with a specified number of copies of an existing string
replace()Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring
search()Executes the search for a match between a regular expression and a specified string
slice()Extracts a section of a string and returns a new string
split()Splits a string into an array of substrings
startsWith()Checks whether a string begins with specified characters
substring()Returns the characters in a string between two indexes into the string
toLocaleLowerCase()Converts a string to lowercase letters, according to the host's locale
toLocaleUpperCase()Converts a string to uppercase letters, according to the host's locale
toLowerCase()Converts a string to lowercase letters
toString()Returns a string representing the specified object
toUpperCase()Converts a string to uppercase letters
trim()Removes whitespace from both ends of a string
valueOf()Returns the primitive value of a String object

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author