function g () {
var x;
function y () {};
var z;
}
I would like to know exactly what order the above code becomes when hoisted.
Theory 1: Order between vars and functions remains as-is:
function g () {
var x;
function y () {};
var z;
}
Theory 2: vars come before functions:
function g () {
var x;
var z;
function y () {};
}
Theory 3: functions come before vars:
function g () {
function y () {};
var x;
var z;
}
Which theory is correct?