Do you know about Var vs Let vs Const

Variables declared with *var* are function scoped, meaning they are accessible within the function they are declared in. If a *var* variable is declared outside of a function, it becomes a global variable and is accessible throughout the entire program. *var* variables can be redeclared and updated within their scope.
It is generally recommended to avoid using *var*, as its behavior with respect to scope can be confusing. However, it may still be used in legacy code, or in cases where you need a variable with function scope that needs to be updated within the function.

Variables declared with *let* are block scoped, meaning they are only accessible within the block they are declared in. This makes them more suitable for use in loops and conditional statements. Like *var*, *let* variables can be updated within their scope, but they cannot be redeclared.
Use *let* when you want to declare a variable that will be re-assigned later, or when you need a block-scoped variable (for example, in a loop).

Variables declared with *const* are also block scoped, but they cannot be updated or redeclared after their initial assignment. This makes them useful for declaring constants or values that should not change.
It is recommended to use *const* whenever you want to declare a constant value that should not be re-assigned.

In general, prefer *const* over *let* and avoid using *var* when possible.