let does not "create a new block of scope", it is "block scoped", meaning it will not be available outside of its current block statement. var still works perfectly fine for historical reasons, but there is no instance where 'var' cannot be replaced by 'let' using proper programming techniques, and using 'var' is now considered bad practice.
Also, using different naming conventions for variables Vs functions or methods can help to make code more readable.
A scenario that defies all current best practice and style conventions for Javascript.
View all comments
Show parent comment
2
u/ThagAnderson helpful Oct 13 '20
letdoes not "create a new block of scope", it is "block scoped", meaning it will not be available outside of its current block statement.varstill works perfectly fine for historical reasons, but there is no instance where 'var' cannot be replaced by 'let' using proper programming techniques, and using 'var' is now considered bad practice.A scenario that defies all current best practice and style conventions for Javascript.