JavaScript solves let statement error in code

Question 2. Answer

Problem 1.
Why do we need var instead of let in JavaScript code?

2. Answer
JS version compatibility issues, ECMAScript 6 can be changed.
ES 5; After ES 6, let is used for variable declarations, and const is used for constant declarations. They are used to replace the var declaration method in ES 5.

The original link:

Read More: