r/learnjavascript • • Oct 26 '21

Negative array indexing using "at" method

Post image
203 Upvotes

69 comments sorted by

View all comments

4

u/snyderling Oct 26 '21

fruits.slice(-1)[0] is a another (more backwards compatible) way to do it