There are two ways to access an individual character in a string. The first is the charAt()
method:
return 'cat' . charAt ( 1 ) ; // returns "a"
If you want to change selection, open document below and click on "Move attachment"
String - JavaScript | MDNheir 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
<span>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 other way (introduced in ECMAScript 5) is to treat the string as an array-like object, where individual characters correspond to a numerical index:
return 'cat'[1]; // returns Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details