JSFiddle - React, Tailwind, and code Playground

JavaScript

var input = [
	'one',
	'two'
];

for(var i in input){
    if(typeof input[parseInt(i, 10) + 1] === "undefined") {
        console.log(i + " is the last index");
    }
}