How can I prevent getting 'undefined' as the last output when using console.log() with a looping construct?
let array = ["Fiji", "Santorini", "Bora Bora", "Vancouver"];
let arrayLength = array.length;
for(let index = arrayLength; index >= 0; index--)
{
console.log(array[index]);
}
Resolved by updating:
let arrayLength = array.length - 1
index >= 0;