DEV Community

Discussion on: Self-Taught Developer Journal, Day 34: TOP JS Foundations Part 4, Arrays and Loops

Collapse
 
axel_nieminen_072275fab50 profile image
niemax

Great post!

Just wanted to point out that in this part;

// Last element
let lastElem = arrayExample[arrayExample - 1];

In order to get the last element you have to count it from the length of the array like this:

let lastElem = arrayExample[arrayExample.length - 1];

Best of luck in your learning process! :)

Collapse
 
jennifertieu profile image
Jennifer Tieu

Ahhh, thank you for pointing that out! I meant to put .length, I will go ahead and fix that.