Hello, I just finished the introduction to Arrays lesson and I’m having trouble understanding why this works to get the last element:
const someArray = [1, 2, 3, 4];
Using square brackets I’m aware that we are printing an element assigned to a specific index. Why does adding -1 after calling the .length property return the final element? I read through all of the MDN documentation on the .length property and didn’t see anything. Isn’t length just used for defining the length of an array and returning the number of elements?