js: Convert self-referential vars to const.

ESLint won’t convert these automatically because it can’t rule out a
behavior difference arising from an access to a self-referential var
before it’s initialized:

> var x = (f => f())(() => x);
undefined
> let y = (f => f())(() => y);
Thrown:
ReferenceError: Cannot access 'y' before initialization
    at repl:1:26
    at repl:1:15

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-10-25 15:26:37 -07:00
committed by Tim Abbott
parent 7ae84d5ce1
commit 02004c9b0f
7 changed files with 7 additions and 7 deletions

View File

@@ -375,7 +375,7 @@ function edit_message(row, raw_content) {
// Do this right away, rather than waiting for the timer to do its first update,
// since otherwise there is a noticeable lag
message_edit_countdown_timer.text(timer_text(seconds_left));
var countdown_timer = setInterval(function () {
const countdown_timer = setInterval(function () {
seconds_left -= 1;
if (seconds_left <= 0) {
clearInterval(countdown_timer);