String Methods in JavaScript - SHARE IT
String Methods in JavaScript - SHARE IT
JavaScript
String Methods
length trimStart() match()
replaceAll() charCodeAt()
toUpperCase() split()
toLowerCase() indexOf()
concat() lastIndexOf()
are
d sh
trim() search()
e an
lik
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
1
length
Returns the length of the string
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
2
slice()
Extracts a portion of a string and returns a
new string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
3
sub()
Extracts a portion of a string and returns a
new string. Deprecated in favor of
substring().
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
4
substr()
Extracts a portion of a string, starting from
the specified position, and returns a new
string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
5
replace()
Replaces a specified value or regular
expression in a string with another value.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
6
replaceAll()
Replaces all occurrences of a specified
value or regular expression in a string with
another value.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
7
toUpperCase()
Converts a string to uppercase letters.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
8
toLowerCase()
Converts a string to lowercase letters.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
9
concat()
Joins two or more strings and returns a
new string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
10
trim()
Removes whitespace from both ends of a
string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
11
trimStart()
Removes whitespace from the beginning
of a string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
12
trimEnd()
Removes whitespace from the end of a
string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
13
padStart()
Pads a string with another string until it
reaches a specified length. The padding is
applied from the start of the string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
14
padEnd()
Pads a string with another string until it
reaches a specified length. The padding is
applied from the end of the string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
15
charAt()
Returns the character at the specified
position in a string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
16
charCodeAt()
Returns the Unicode value of the character
at the specified position in a string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
17
split()
Splits a string into an array of substrings.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
18
indexOf()
Returns the index of the first occurrence of
the specified value in a string, or -1 if it is
not present.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
19
lastIndexOf()
Returns the index of the last occurrence of
the specified value in a string, or -1 if it is
not present.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
20
search()
Searches a string for a specified value and
returns the position of the match.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
21
match()
Searches a string for a match against a
regular expression, and returns the
matches as an array.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
22
matchAll()
Returns an iterator of all matches of a
regular expression in a string.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
23
includes()
Determines whether a string contains the
specified value.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
24
startsWith()
Determines whether a string begins with
the specified characters.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Sunil Vishwakarma
25
endsWith()
Determines whether a string ends with the
specified characters.
are
d sh
an
like
@LINKINSUNIL swipe @OFFICIALSKV
Frontend Developer