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
Top comments (0)