js: Simplify indexing arrays from the end with Array#at.

https://github.com/tc39/proposal-relative-indexing-method

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-01-24 00:05:06 -08:00
committed by Tim Abbott
parent 0b03628324
commit c6b372b471
13 changed files with 26 additions and 33 deletions

View File

@@ -440,7 +440,7 @@ export function initialize(home_view_loaded) {
// If we fall through here, we need to keep fetching more data, and
// we'll call back to the function we're in.
const messages = data.messages;
const latest_id = messages[messages.length - 1].id;
const latest_id = messages.at(-1).id;
load_messages({
anchor: latest_id,