DEV Community

Discussion on: Var, let and const- what's the difference?

Collapse
 
gamebecks profile image
gamebecks

Hi, you have said that variable declared as var will have global scope if declared outside a function. But the same can even be said for variables declared as let and const. They indeed are locally scoped but when done outside a function, they will have global scope like var.
Please correct me if am wrong?