const arr =[1,2,3];
 
for (let i = 0; i < arr.at(-1); i++){
console.log(arr[i])
}
 
 
Click Run to execute JavaScript.