Below are some basic methods that can be used with strings. The .length
property as well as the indexer and the charAt()
methods are all string properties/methods that you will be using in the future. The syntax of the following properties and methods are shown below.
string.length
- returns the number of characters in the string
Indexer (string[index]
)
- gets a single-character string at location the index
- index starts from 0
- if
index
is outside the range of string characters, the indexer returnsundefined
charAt(index)
- gets a single-character string at location index
- works similarly to the indexer