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)