For this purpose it doesn't matter if you use var
, const
or let
. The last two are newer JavaScript syntax with the intention of overcoming some peculiarities with var
. In general the recommendation these days is to not use var
anymore as how it works on certain corner cases can be unexpected.
const
means the variable cannot be redefined, so it's suitable to use for library imports or constant values. let
behaves pretty much like var
without its peculiarities.
More info https://codeburst.io/difference-between-var-let-and-const-in-javascript-fbce2fba7b4