Ecmascript 6: Scoping – Block scoped variable
Javascript followed function level and global scope for a very long time which created a lot of problems. Developers could declare a variable anywhere as global and variables lived even outside loops and if else blocks because of the function level scope. Ecmascript 6 came up with support for block level
Read more