Skip to content

Instantly share code, notes, and snippets.

@ricklopez
Last active October 28, 2018 17:01
Show Gist options
  • Save ricklopez/863af812ce136dae152ed0163833a6fd to your computer and use it in GitHub Desktop.
Save ricklopez/863af812ce136dae152ed0163833a6fd to your computer and use it in GitHub Desktop.

Feedback

Feedback Form

Notes

  1. Sync vs Async
    • JS executes code in a synchronous manner one function at a time one statement at a time
    • JS is single threaded
      • that means only one statement is executed at a time.
    • Asynchronous mean two or more things happening at a time. In JS that means deferring remaining execution of a function
      • We need this because some operation can take be very slow:
        • image processing
        • file operations I/O
        • HTTP Request and waiting for response
        • Sometimes making huge calculations can be kinda slow
      • These types of operation on our Execution Stack Block further execution
  2. CallBacks
      A callback function is a function passed into another function as an argument, 
      which is then invoked inside the outer function to complete some kind of routine or action.
    
  3. Promises
      A Promise is an object representing the eventual completion or failure of an asynchronous operation. 
    
    
  4. Async/Await
      An async function can contain an await expression that pauses the execution of the async function 
      and waits for the passed Promise's resolution, and then resumes the async function's execution and 
      returns the resolved value. Remember, the await keyword is only valid inside async functions. 
      If you use it outside of an async function's body, you will get a SyntaxError.
    
  5. Things we didn't cover related to ASYNC in JS
    • Generators
    • Observables
    • (We'll get a course out on these two soon. Keep an eye out on the GroupSession channel in Slack)
  6. Where to go from here

Demo Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment