Important string methods
Tags: javascript, webdev, beginners, programming
Published: 2021-12-27 15:54:55

**1. <u>concat</u>(str1, str2, ... , strN)**
The concat() method joins two or more strings. The concat() method does not change the existing strings. The concat() method returns a new string.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/um43uzo65oo60xuvvkkh.png)

**2. <u>endsWith</u>(searchString, length)**
Checks whether a string ends with specified string/characters. It only returns true or false. The endsWith() method is case sensitive.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vl8ycl51un4e7ixx3v4a.png)

**3. <u>includes</u>(searchString, position)**
Checks whether a string contains the specified string/characters. It only returns true or false. The includes() method is case sensitive.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/az4whit7yf3iyrugrerr.png)

**4. <u>indexOf</u>(searchValue, fromIndex)**
Returns the position of the first found occurrence of a specified value in a string. The indexOf() method returns -1 if the value is not found. The indexOf() method is case sensitive.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hmx3ymbg44zadz8wlwxs.png)

**5. <u>lastIndexOf</u>(searchValue, fromIndex)**
Returns the position of the last found occurrence of a specified value in a string. The indexOf() method returns -1 if the value is not found. The lastIndexOf() method is case sensitive.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gjdoafhg6ds08mwy5w7o.png)

**6. <u>replace</u>(regexp/substr, newSubstr/replacerFunction)**
Searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9klhlbs5o3qtcter6dds.png)

**7. <u>slice</u>(beginIndex, endIndex)**
Extracts a part of a string and returns a new string.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xyvwzar4loyxeyyoqku5.png)

**8. <u>split</u>(separator, limit)**
Splits a string into an array of substrings. If (" ") is used as separator, the string is split between words.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y2byid4qxm3ylo8ifzfc.png)

**9. <u>startsWith</u>(searchString, position)**
Checks whether a string begins with specified characters. It only returns true or false. The startsWith() method is case sensitive.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvcmrrp7dcy5cy1k1di9.png)

**10. <u>toLocaleLowerCase</u>()**
Converts a string to lowercase letters, according to the host's locale. The locale is based on the language settings of the browser. The toLocaleLowerCase() returns the same result as toLowerCase(), except for locales that conflict with the regular Unicode case mappings (such as Turkish).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9321uhxescypt2mu7og.png)

**11. <u>toLocaleUpperCase</u>()**
Converts a string to uppercase letters, according to the host's locale. The locale is based on the language settings of the browser. The toLocaleUpperrCase() returns the same result as toLowerCase(), except for locales that conflict with the regular Unicode case mappings (such as Turkish).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fbo1p177vspfhlqrp9v.png)

**12. <u>toLowerCase</u>()**
Converts a string to lowercase letters.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qir24tde4hdothd9gkg.png)

**13. <u>toLowerCase</u>()**
Converts a string to uppercase letters.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hgiv3w0ops8c11kjsosf.png)