0% found this document useful (0 votes)
2 views

JS String Methods

The document provides an overview of basic JavaScript string methods, emphasizing that strings are immutable and all methods return new strings. Key methods include length, charAt(), toUpperCase(), trim(), and split(), among others. Each method is briefly described, highlighting its functionality and usage in string manipulation.

Uploaded by

Marcus Bautista
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

JS String Methods

The document provides an overview of basic JavaScript string methods, emphasizing that strings are immutable and all methods return new strings. Key methods include length, charAt(), toUpperCase(), trim(), and split(), among others. Each method is briefly described, highlighting its functionality and usage in string manipulation.

Uploaded by

Marcus Bautista
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

</ JS String Methods />

JavaScript

1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1
</Basic String Methods
Javascript strings are primitive and immutable: All string
methods produce a new string without altering the original
string.

● String length ● String toUpperCase() ● String repeat()


● String charAt() ● String toLowerCase() ● String replace()
● String charCodeAt() ● String concat() ● String replaceAll()
● String at() ● String trim() ● String split()
● String [ ] ● String trimStart()
● String slice() ● String trimEnd()
● String substring() ● String padStart()
● String substr() ● String padEnd()

1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1
</String length </Output

● length: Returns the number of characters


in the string.
</String charAt() </Output

● charAt(): Returns the character at the


given index.
</String charCodeAt() </Output

● charCodeAt(): Returns the Unicode (ASCII)


value of the character at the given
index.
</String at() </Output

● at(): Similar to charAt(), but supports


negative indexing.
</String [ ] </Output

● str[]: Accesses a character like an array


but is read-only.
</String slice() </Output

● slice(): Extracts part of a string


(supports negative indexes).
</String substring() </Output

● substring(): Negative indexes are treated


as 0, and if start > end, they swap
automatically.
</String substr() </Output

● substr(): Extracts a portion of a string


based on starting position and length
(deprecated).
</String toUpperCase() </Output

● toUpperCase(): Converts all characters to


uppercase.
</String toLowerCase() </Output

● toLowerCase(): Converts all characters to


lowercase.
</String concat() </Output

● concat(): Joins two or more strings.

</String trim() </Output

● trim(): Removes spaces from both sides.


</String trimStart() </Output

● trimStart(): Removes spaces from the


beginning.
</String trimEnd() </Output

● trimEnd(): Removes spaces from the end.


</String padStart() </Output

● padStart(): Adds padding at the beginning


until it reaches the specified length.
</String padEnd() </Output

● padEnd(): Adds padding at the end.


</String repeat() </Output

● repeat(): Repeats the string.

</String replace() </Output

● replace(): Replaces only the first


occurrence.
</String replaceAll() </Output

● replaceAll(): Replaces all occurrences.

</String split() </Output

● split(): Splits the string into an array


based on the delimiter.
</ THANK YOU! />

JavaScript

1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1

You might also like