JavaScript String
I am Sourav Das Shovon .Today I am sharing my knowledge about JS String With You.
What is JS String?
A JS string stores a series of characters like “Sourav Shovon”. A string can be any text inside double or single quotes:
var Full_Name1 = “X”;
var Full_Name2 = ‘Y’;
String indexes are zero-based.
JS String has some String Methods like:
- Length
length The length property returns the number of characters (length of a string).
Syntax: string.length
2. toUpperCase
toUpperCase() which converts a string to uppercase letters.
Syntax: string.toUpperCase()
3. toLowerCase
toLowerCase() which converts a string to a lower case.
Syntax: string.toLowerCase()
4. indexOf
The indexOf() method returns the position of the first occurrence of a specified value in a string.
Syntax: string.indexOf(searchvalue, start)
5. trim
Get Sourav Das Shovon’s stories in your inbox
Join Medium for free to get updates from this writer.
trim() which Removes whitespace from both ends of a string.
Syntax: string.trim()
You can Check it in detail by Clicking on it JS String Method
6. startsWith method
startsWith method returns whether the string starts with the provided string.
7. endsWith method
endsWith method returns whether the string ends with the provided string.
8. includes method
includes method checks whether a string contains the specified string/characters.
9. charAt method
charAt method Returns the character at the specified index (position).
10. concat method
concat method joins two or more strings and returns a new joined strings.
Some JS String Properties are :
constructor which returns the string’s constructor function.
length which returns the length of a string.
prototype which allows you to add properties and methods to an object.






