Javascript - Indexing
Code Life
By Pierre Marsaa
What is String Indexing?
Strings are like a sequence of characters lined up in order. Each character has a position called an index. Think of it like numbered boxes, where each box holds one character!
Let's look at the name "Aquachu":
↗️
Loading editor...
↶
↷
Why Start at 0?
In programming, we count starting from 0, not 1. This is called zero-based indexing. So the first character is at index 0, the second at index 1, and so on. It might feel weird at first, but you'll get used to it!
Verify