arr[-1] js code example
Example 1: access index of array javascript
let first = fruits[0]
// Apple
let last = fruits[fruits.length - 1]
// Banana
Example 2: array -1 javascript
//The index of any item that does not exist in an array is -1
//example:
a = ["help","I'm","a","sentient","array"];
a.indexOf("Icecream");//this returns -1