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)