[ad_1]
var x declares the variable xbut doesn’t assign anything to it.
If you did set its value to undefined, then that would be undefined:
function x(){}
var x = undefined;
console.log(typeof x) //"undefined"So what you made in your example is just
var x;
function x(){}
While in my example it becomes
var x;
function x(){}
x = undefined;
5
[ad_2]
solved What is difference between hoisting var x = 3 and var x