If you can do <Array>.first(), how do you do <Array>.second()?

Hello, quick question:

I see in the SugarCube documentation that .first() returns the first member of the array; so how do you get the second member? Maybe a simple question, but google search is turning up nothing.


Ah, is it <Array>[number]? As in: $pies[2]? I found something else that used an array and something like this was in it, and it seems to work. :grin:

To access any element of an array you just do $arrayName[index], where “index” is a number from 0 to $arrayName.length - 1.

So, to access the second element you’d use $arrayName[1], because the first element is at $arrayName[0].

For more information see the MDN Array documentation.