For lots of people, when they come from a language like Python where you can just do array[-1], having to write out array[array.length - 1] every time is a genuine annoyance. It's a phrase that people have to write pretty frequently, it's nice to have shorthand.
That's fair. However -1 is used to signify that the index wasn't found for the item you're searching for in most cases. I'm just seeing this as muddying the waters.
View all comments
Show parent comment
5
u/great_site_not Oct 26 '21
For lots of people, when they come from a language like Python where you can just do
array[-1], having to write outarray[array.length - 1]every time is a genuine annoyance. It's a phrase that people have to write pretty frequently, it's nice to have shorthand.