Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Asynchronous JavaScript

Asynchronous JavaScript

What is Asynchronous about JavaScript?
Includes code Examples and explains why it is better. Part of http://nodegirls.io/ presentation "What is Node.js"

Natalia Baltazar

July 02, 2016
Tweet

More Decks by Natalia Baltazar

Other Decks in Programming

Transcript

  1. What is asynchronous JavaScript ? JS is actually single threaded

    and is mostly synchronous Async things are: • AJAX calls • Events
  2. /******************************************************************************************** For example, if you go down to a fast

    food joint and order a cheeseburger they will immediately take your order and then make you wait around until the cheeseburger is ready. In the meantime they can take other orders and start cooking cheeseburgers for other people. Imagine if you had to wait at the register for your cheeseburger, blocking all other people in line from ordering while they cooked your burger! This is called blocking I/O because all I/O (cooking cheeseburgers) happens one at a time. Node, on the other hand, is non-blocking, which means it can cook many cheeseburgers at once. ********************************************************************************************/ https://github.com/maxogden/art-of-node