Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their
length
, to build and concatenate them using the
+ and += string operators, checking for the existence or location of substrings with the
indexOf()
method, or extracting substrings with the
substring()
method.
If you want to change selection, open document below and click on "Move attachment"
String - JavaScript | MDNks like this:
let longString = "This is a very long string which needs \
to wrap across multiple lines because \
otherwise my code is unreadable.";
Both of these result in identical strings being created.
DescriptionEdit
<span>Strings are useful for holding data that can be represented in text form. Some of the most-used operations on strings are to check their length , to build and concatenate them using the + and += string operators, checking for the existence or location of substrings with the indexOf() method, or extracting substrings with the substring() method.
Character access
There are two ways to access an individual character in a string. The first is the charAt() method:
return 'cat'.charAt(1); // returns "a"
The o Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details