General question


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?


This is valid JS:


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:

var aoeu = 5;

-> undefined

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