ES6 introduced the keywords let
and const
for declaration of variables.
Is there still reason to use var
? If yes, what scenarios to use?
ES6 introduced the keywords let
and const
for declaration of variables.
Is there still reason to use var
? If yes, what scenarios to use?
Well, by doing a brief search on the internet, including SOen, there is no stated advantage. Until then, let
and const
offer some 'protection by following rules' more than var
, but they do the same job.
To say no advantage, some browsers still do not accept the declaration of let
and const
, but otherwise, var
can already be retired.