PDA

View Full Version : Javascript String methods



charlesprabhu
12-28-2022, 12:22 AM
Slice
Slice extracts a part of a string and returns the extracted part in a new string.
The method takes 2 parameters: start position, and end position.

Length
Returns the length of a string.

Replace
Replace method replaces a specified value with another value in a string.

ToLowerCase & ToUpperCase
A string is converted to upper case with toUpperCase.
A string is converted to lower case with toLowerCase.

Concat
Concat joins two or more strings.

Trim
The trim method removes whitespace from both sides of a string.

CharAt
The CharAt method returns the character at a specified index (position) in a string.