General question


#1

is there a specific order that languages follow? from top to bottom? like i can declare a global variable at the end of my code and not first and will it work? just curious, C C++ JAVA C# javascript?


#2

This is valid JS:

f()

function f() {
    console.log('f was called');
}

There has to be an order but sometimes that order is to read certain things before executing others.

Sometimes a variable might be created, but remain initialized until the line that caused its creation is executed:

console.log(aoeu);
var aoeu = 5;

-> undefined

The variable is there. But its value has not been defined.