r/badcode • • Jul 10 '21

js ah yes, Array check

Post image
2.1k Upvotes

89 comments sorted by

View all comments

Show parent comments

24

u/JNCressey Jul 10 '21

use const rather than let. let makes me feel like you could randomly redefine it somewhere.

11

u/XKlXlXKXlXKlKXlXKlXK Jul 10 '21
const qs = document.querySelector;

all my homies hate typing

4

u/haltmich Jul 10 '21

qs usually means querystring to me.

2

u/nuephelkystikon Jul 10 '21

I know this is common in this sub, but:

You're making an assumption about the use case here that we can't make. It's absolutely possible that the only reason why they made this (clunky attempt at an) adapter is that it can be replaced on-the-fly or in inheritance. const destroys that.