DEV Community

Cover image for Reading Snippets [55 => Scoping]
Calvin
Calvin

Posted on

Reading Snippets [55 => Scoping]

It is important to try and avoid scope pollution when using global variables in a program. Tightly scoping variables using the block scope provides several advantages:

🙂 Makes code more legible as blocks organize code in discrete sections

🙂 Makes code easier to understand

🙂 Makes code easier to maintain

🙂 Saves memory in code

Codecademy: JavaScript Course

Top comments (0)