In many examples explaining the Event Loop, they always use the setTimeout
to illustrate it.
According to those explanations, when the JS runtime meets the setTimeout
instruction, it knows there is a callback so it puts the instruction in the Event Queue
so that it puts it in the Callback Queue
.
My questions are : how the runtime knows if it has to put the instruction in the Event Queue
? does it check the parameters and if a param is a function so that means it's a callback ? what are the criteria to be in that Event Queue
?