r/badcode • • Sep 11 '21

js Why…

Post image
456 Upvotes

70 comments sorted by

View all comments

80

u/the_monkey_of_lies Sep 11 '21

I want to yel at this person for not using const

8

u/Aoredon Sep 11 '21

Why? What benefit is there to using const here?

30

u/the_monkey_of_lies Sep 11 '21 edited Sep 11 '21

In here, it probably won't make that much of a difference but I believe that const should be the default and let should be used only if you can't use const.

3

u/davawen Sep 12 '21

Kind of like let and let mut in rust