Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

why does an array index start at 0

Array address: 0x7ffe9472bad0
Array[0] = 0x7ffe9472bad0
Array[1] = 0x7ffe9472bad4
Array[2] = 0x7ffe9472bad8
...

The first element and the array itself points to the same memory location, 
so it is 0 elements away from the location of the array itself.

// https://albertkoz.com/why-does-array-start-with-index-0-65ffc07cbce8
Source by albertkoz.com #
 
PREVIOUS NEXT
Tagged: #array #index #start
ADD COMMENT
Topic
Name
7+1 =