What is the index of the last element of an array with 5 elements?
- 3
- 4
- 5
- -1 (JavaScript doesn't support accessing the last element directly)
The index of the last element in an array with 5 elements is 4. JavaScript arrays are zero-indexed, so the index of the last element is one less than the total number of elements in the array. The other options are not correct for this scenario.
Loading...
Related Quiz
- What is the default binding of "this" in JavaScript?
- Which property of the Response object represents the status text of the response?
- Can arrow functions be used as constructors?
- The method _______ is used to sort the elements of an array.
- A function declaration is hoisted to the top of the ________ in which it was defined.