Bit confused by how JavaScript/JQuery executes code?
I'm a C++ programmer, and I'm watching some tutorials on JS/JQ and I'm having trouble understanding something (something no one seems to explain).
Where is the executor in JS/JQ? In C++, code is executed in an ordered fashion, staring at main, and flowing from top to bottom, and finishing at the end of the main function.
With JS/JQ it seems almost mysterious. If I have a .ready() function, does it execute it once, or does it keep looping? If it only executes it once, then how is it possible that other events inside it can continuously loop or get triggered later in time?
Just doesn't make any sense how this all works under the hood...