Search
Let's see an example where we are adding an element at the end of the array:
Here, the last element in the vegetables array has an index 2. To add an element at the end of the array, we should add the new element at index 3.
vegetables
2
3