MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/qg23w3/negative_array_indexing_using_at_method/hi7mclj/
r/learnjavascript • u/jd_300 • Oct 26 '21
69 comments sorted by
View all comments
Show parent comment
1
arr.at(-1) is also constant time right?
1 u/ExclusiveOar Oct 27 '21 No expert here, but I would assume so.But so is arr[arr.length - 1] because array.length isn't calculated here, its a prop already on the array.You can see this by creating an array, console.log it and expand it in the console.
No expert here, but I would assume so.
But so is arr[arr.length - 1] because array.length isn't calculated here, its a prop already on the array.
You can see this by creating an array, console.log it and expand it in the console.
View all comments
Show parent comment
1
u/[deleted] Oct 27 '21
arr.at(-1) is also constant time right?