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

Most Frequently Used String Methods in Real Time Projects 1696233506

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Most Frequently Used String Methods in Real Time Projects 1696233506

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

( () JavaScript)


a Y~ c r1
8 STRING METHODS

@thecodecrumbs
www,codecrumbs.com Swipe
( 0 JavaScript)

Length
The length property returns the number of characters in a
string including whitespace.

canst str = 'TheCodeCrumbs' ;


str . length

@thecodecrumbs
www,codecrumbs.com 01
( 0 JavaScript)

Slice
slice() extracts a part of a string and returns the extracted
part in a new string

canst str = 'TheCodeCrumbs';


str . slice ( 3 , 7 );

@thecodecrumbs
www,codecrumbs.com 02
( () JavaScrip0

Replace
The replace() method replaces a specified value with another
value in a string

const str = 'TheCodingCrumbs';


str . replace ( 'Coding', 'Code');

@thecodecrumbs
www,codecrumbs.com 03
( 0 JavaScript)

Upper & Lower


Case
This methods converts a string to upper or lowercase

const str = 'TheCodeCrumbs';

str . tolowerCase ();

str . toUpperCase ();

@thecodecrumbs
www,codecrumbs.com 04
( 0 JavaScrip0

Contact
concat() joins two or more strings

const str = 'TheCode';


str . concat ( 'Crumbs');

@thecodecrumbs
www,codecrumbs.com 05
( 0 JavaScript)


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

canst str = ' TheCodeCrumbs


str . trim ();

@thecodecrumbs
www,codecrumbs.com 06
( 0 JavaScript)

Char At
The charAt() method returns the character at a specified
index (position) in a string:

canst str = 'TheCodeCrumbs';


str . charAt ( S);

@thecodecrumbs
www,codecrumbs.com 07
( () JavaScript)

Split
The split() method converts a string into an array

const str = 'The,Code,Crumbs';


str . split ( ', ');

@thecodecrumbs
www,codecrumbs.com 08
Add to Favourites

How m any do
yoM know ?
@thecodecrumbs
www.codecrumbs.com

Q Leave a comment Save for later I;:]

You might also like