educative.io

Can we use let or const instead of var inside constructor function to declare protected variables and values?

Can we use let or const instead of var inside constructor function to declare protected variables and values?


Type your question above this line.

Course: https://www.educative.io/collection/10370001/5862304337887232
Lesson: https://www.educative.io/collection/page/10370001/5862304337887232/4609519587950592

Hi @Manan_Jain,
We can use let and const. Using var makes sure that the variables are available in the full scope of
the constructor function.

1 Like