The JavaScript Event loop for Emergency Physicians

If you’re a reader of my blog past or present you’ll know that I’ve long been interested in programming and am also an Emergency Medicine physician.  While studying javacript callback functions I was referred to this talk which explains them well, but it didn’t really “click” until I saw the visual “event loop” waiting for it’s opportunity to let the main stack know there were results to dealt with from prior callback functions. What’s a callback function? This is one I’m still wrapping my head around, but it allows for a task to be worked on while the main program continues to function.  This way the main program is not held up waiting for results that may be dependent on some 3rd party, such as downloading a file or communicating with an API, or any other calculation or processing that needs to be done. A callback function seemed confusing to me because I was trying to understand the literal terms of what was being “called back”.  While I’m still not certain I get that, let me explain it in terms of how the emergency room functions.  If you’ve ever been a patient in the ER or in a hospital and had a health care worker stop into your room to keep you updated on results or what exactly you’re waiting for, this should make a lot of sense to you. And if you happen to also be an Emergency Physician or Practitioner managing complex care for many patients, you’ll also recogniz...
Source: Mr. Hassle's Long Underpants - Category: Emergency Medicine Authors: Tags: Computing callback functions event loop JavaScript Source Type: blogs