var d = 1;
(function(){
d = '2'
console.log(typeof d)
function d() {
}
})()
console.log(typeof d)
Could you explain why the second log prints out "number"?
var d = 1;
(function(){
d = '2'
console.log(typeof d)
})()
console.log(typeof d)
I tried to remove the function from the IIFE, and the result of second log becomes "string". I am very confused about it.