Babel transpile "let foo;" to "var foo = void 0" why not just "var foo;"?


Hello everyone! I am just interested why babel transpile this:

let foo;

To this:

var foo = void 0;

Why the result is not just var foo; ? It’s has no impact, because uglifyjs turn it to

var foo;

but I want to know why this happen. Why void 0 is needed? The void 0 is a shortcut for undefined, but why we need to do this manually? Variables should be always has undefined value by default, didn’t they?