Indexing of Strings
Before we move to string operations, an important concept to discuss regarding strings is indexing. It facilitates the fast lookup of characters within a string by specifying character positions. Suppose we wanted to access the character r from the string in code block below. The position of r in the string is 2. This is because the indices, or the positions in a string start from 0, and not 1, as illustrated below.
JAVASCRIPT
1var name = "Chris"


