[Go to site: main page, start]

0% found this document useful (0 votes)
2 views1 page

JavaScript String Methods Cheat Sheet

This document is a cheat sheet for JavaScript string methods, listing various methods along with examples and their purposes. It includes methods for string manipulation, such as length, character access, substring extraction, case conversion, and more. Each method is presented with a brief description of its functionality.
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 views1 page

JavaScript String Methods Cheat Sheet

This document is a cheat sheet for JavaScript string methods, listing various methods along with examples and their purposes. It includes methods for string manipulation, such as length, character access, substring extraction, case conversion, and more. Each method is presented with a brief description of its functionality.
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

JavaScript String Methods Cheat Sheet

Method Example Purpose

length [Link] String length

charAt()/at() [Link](-1) Get character

includes() [Link]('abc') Contains substring

startsWith() [Link]('Hi') Prefix check

endsWith() [Link]('.js') Suffix check

indexOf()/lastIndexOf() [Link]('a') Find occurrence

slice() [Link](1,4) Extract substring

substring() [Link](1,4) Extract substring

replace() [Link]('a','b') Replace first match

replaceAll() [Link]('a','b') Replace all

toLowerCase() [Link]() Lowercase

toUpperCase() [Link]() Uppercase

trim()/trimStart()/trimEnd() [Link]() Trim whitespace

split() [Link](',') String to array

join() [Link]('-') Array to string

repeat() '*'.repeat(5) Repeat string

concat() [Link]('!') Concatenate

padStart()/padEnd() '5'.padStart(3,'0') Pad string

localeCompare() [Link](b) Compare strings

match() [Link](/\d+/) Regex match

search() [Link](/\d+/) Regex search

charCodeAt() 'A'.charCodeAt(0) Character code

[Link]() [Link](65) Code to character

You might also like