Explain the difference between const and let in node js?
S.no | let | const |
---|---|---|
1. | It can be reassigned, but can’t be redeclared in the same scope. | It can be assigned an initial value, but can’t be redeclared in the same scope, and can’t be reassigned. |
2. | It is beneficial to have for the vast majority of the code. It can significantly enhance your code readability and decrease the chance of a programming error. | It is a good practice for both maintainability, readability and avoids using magic literals |
BY Best Interview Question ON 25 Jun 2020