Step 1: Understanding Array Indexing:
JavaScript arrays use zero-based indexing. This means the first element of an array is at index 0, the second is at index 1, and so on.
Step 2: Linking Array Length to Last Index:
If an array contains $N$ elements, its .length property returns $N$.
Because indexing starts at $0$, the indices of the array range from:
$$0 \text{ to } (N - 1)$$
Therefore, the last element is always located at index:
$$\text{Last Index} = \text{myArray.length} - 1$$
Step 3: Verification of Options:
Assume an array myArray = ["A", "B", "C"] with a length of $3$.
• (A) myArray[length+1]: Tries to access index $4$, which is empty/undefined.
• (B) myArray[length]: Tries to access index $3$, which is also undefined (one index past the last valid element).
• (C) myArray[length-1]: Accesses index $2$ ("C"), successfully retrieving the last element.
• (D) myArray[MyArray]: Passes an object reference as an index, which is invalid.