The code below logs value a after assignments
var a = []
if (true) {
a = 1
function a() {}
a = 2
function a() {}
a = 3
console.log('0: ', a)
}
console.log('1: ', a)
I suspect the output might be:
0: 3
1: 3
But actually the code above logs
0: 3
1: 2
Why?