JavaScript allows this:
function outside() {
inside();
return 44;
function inside() {
console.log("inside");
}
}
When outside is called the output is:
inside
44
Why does this work and why doesn't it work for other statements like the one below:
function outside() {
return 44;
console.log("inside");
}
which just prints 44.