2

My lint is warning me every time I use "let" on a Angular App I'm working on. Both let and const are working at the moment, but lint is telling me to use const on Visual Studio Code.

Gabriel Panza
  • 309
  • 2
  • 10

2 Answers2

2

A const is used if the value of the variable is not going to change, i.e. it will be assigned only once.

1

Link to documentation

let and const are two relatively new types of variable declarations in JavaScript. As we mentioned earlier, let is similar to var in some respects, but allows users to avoid some of the common “gotchas” that users run into in JavaScript. const is an augmentation of let in that it prevents re-assignment to a variable.

Maxim Kasyanov
  • 938
  • 5
  • 14