I normally wouldn't make this kinda pedantic observation, but since you say you're "only 4 weeks into studies"...
Get rid of the var. You don't want to use that in "modern" JavaScript design. You should always, always, always use let or const.
It may feel right now like that's a semantic, rather useless, observation. But it's not just based on coding dogma. JavaScript has some particular, umm... headaches regarding this and the hoisting of var-declared variables into global scope. These headaches are solved by religiously sticking with let or constant.
The full description of why var is "problematic" is far longer than I care to type in this reply. But as you get further down your studies, it's a good thing to research.
Also, FWIW, the var keyword tends to cause headaches in other languages as well (e.g., C#).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I normally wouldn't make this kinda pedantic observation, but since you say you're "only 4 weeks into studies"...
Get rid of the
var
. You don't want to use that in "modern" JavaScript design. You should always, always, always uselet
orconst
.It may feel right now like that's a semantic, rather useless, observation. But it's not just based on coding dogma. JavaScript has some particular, umm... headaches regarding
this
and the hoisting ofvar
-declared variables into global scope. These headaches are solved by religiously sticking withlet
orconstant
.The full description of why
var
is "problematic" is far longer than I care to type in this reply. But as you get further down your studies, it's a good thing to research.Also, FWIW, the
var
keyword tends to cause headaches in other languages as well (e.g., C#).