Allright people, here I am asking for help once again! Just can’t understand one thing and it’s driving me crazy, I want to get the last number (the one at the last index) from an array of numbers.
I want to use a variable, called test as an index, but I keep getting “undefined”…what am I doing wrong?
Output from console.log(test) = 3 so this works
Output from console.log(arr[test]) = undefined
let test = 0;
test = arr.length;
console.log(test);
console.log(arr[test]);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36