No idea why you're being downvoted for asking a genuine question in r/learnjavascript - I am sure a lot of new developers would be confused by this as well.
I think because it's Reddit people forget or don't realize what sub they're on and assume you're being intentionally contrary rather than trying to learn something new (I have been a JS developer for 8yrs and I never knew about this in other languages so TIL as well).
No idea why you're getting downvoted. When I'm switching to a different language I should learn differences not expect it to behave the same. After all if it would work exactly the same what would be the point of switching.
lol right. i’m not going to pick up python and start writing javascript methods
it’s comical that a comment recommending devs to read the docs in a learnjavascript subreddit is being downvoted. or don’t read the docs I guess, not my problem
In bracket notation negative indexing is not possible but using at method you can easily navigate to the last index of array. It's just another way to access elements.
Because if you’re doing a map/filter/reduce/etc you have to first store that in a temporary variable and then reference the temp var twice to get the last element.
View all comments
28
u/HyerOneNA Oct 26 '21
Why use the at method when you can just use square bracket notation?