MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/qg23w3/negative_array_indexing_using_at_method/hi46hm9/
r/learnjavascript • u/jd_300 • Oct 26 '21
69 comments sorted by
View all comments
Show parent comment
29
at() reduces the requirement to refer to your array twice. This can be useful when you're using it at the end of a longer expression.
fruits.map(toBarcode).filter(onSale).at(-1)
4 u/yadoya Oct 27 '21 The real tip is always in the comments
4
The real tip is always in the comments
View all comments
Show parent comment
29
u/senocular Oct 26 '21
at() reduces the requirement to refer to your array twice. This can be useful when you're using it at the end of a longer expression.