As far as possible, the keyword 'var' should be replaced with the keyword 'let'. When doing this replacement, be aware that the two keywords are different, and sometimes you cannot just do a simple replacement. Keep in mind these differences between 'var' and 'let':
The scope differs between the two
Global let variables are not properties on the global object
When using let in for-loops, a new binding is created for each iteration
A let variable is uninitialized until it's declared
As far as possible, the keyword 'var' should be replaced with the keyword 'let'. When doing this replacement, be aware that the two keywords are different, and sometimes you cannot just do a simple replacement. Keep in mind these differences between 'var' and 'let':
See https://hacks.mozilla.org/2015/07/es6-in-depth-let-and-const/ for more in-depth understanding of when replacing is not suitable.