how to check if the last index == the array length-1 code example Example: last index of array js array.lastIndexOf(searchElement[, fromIndex]);