DEV Community

Discussion on: How to create a variable in JS?

Collapse
 
marzelin profile image
Marc Ziel • Edited

You can also create one without using any of let, var, and const if you're not in strict mode

You should mention that this is an antipattern.

Also, when you declare a function you're creating a variable since a function is just a value in JS and can be overridden.
What's interesting about this is that functions are block-scoped so technically JS had block-scoped variables before ES2015.

Collapse
 
codewithnithin profile image
codeWithNithin

ok