r/learnjavascript • • Oct 26 '21

Negative array indexing using "at" method

Post image
203 Upvotes

69 comments sorted by

View all comments

6

u/Dodgy-Boi Oct 26 '21

array.reverse()[0]

5

u/NekkidApe Oct 27 '21

In case anyone is using this... It's mutating the original array

1

u/Dodgy-Boi Oct 27 '21

I saw a huge battle about index. And came up with another solution (I honestly tried to make it as ridiculous and/or unique as possible).

2

u/NekkidApe Oct 27 '21

Maybe reverse and shift then for extra points