atom / language-javascript

JavaScript language package for Atom
Other
194 stars 236 forks source link

use let instead of var to define loop variables #714

Open MichaelKreil opened 2 years ago

MichaelKreil commented 2 years ago

Requirements

Description of the Change

Use "let" instead of "var" to define loop variables.

Alternate Designs

I can't see any other approaches.

Benefits

Defining loop variables with "var" can lead to unwanted side effects. Therefore it is recommended to use "let".

Possible Drawbacks

There might be some developers who are not using ES6, like very old legacy versions of node.js. I believe node.js uses "let" since version 4.0.

Applicable Issues

At some point, we will have to switch to "let". The question is: when, if not now?

icecream17 commented 2 years ago

Actually I redact that approval since there's one that also uses const, see https://github.com/atom/language-javascript/pull/691