Essential JavaScript string method you should know

Sahadat Hossain
2 min readMay 7, 2021

In this article, I will summarize some JavaScript string method you should know.

A string can be anything inside double or single quotes.

String Example

Some of important string method for beginner:

  1. charAt(): The charAt() method returns the new string at the specified index in a string.
charAt() method example

2. concat():The concat() method is used to join two or more strings.

concat() method example

3. includes(): The includes() method is case sensitive. It finds whether a string include the string of a specified string. It return Boolean true or false.

includes() method example

4. endsWith():The endsWith() method is case sensitive. It finds whether a string end with the string of a specified string. It return Boolean true or false.

5. startsWith():The startsWith() method is case sensitive. It finds whether a string start with the string of a specified string. It return Boolean true or false.

6. toLowerCase(): The toLowerCase() method convert the a string value to lower case.

7. toUppercase():The toUpperCase() method convert the a string value to upper case.

8. indexOf(): The indexOf() method is case sensitive. The indexOf() method return the index of first occurrence of specific value of string.

9. lastIndexOf(): The lastIndexOf() method is case sensitive. The lastIndexOf() method return the index of last occurrence of specific value of string.

10. trim(): the trim() method delete the whitespace from both end of string.

--

--