Giter VIP home page Giter VIP logo

javascript-async's Introduction

CallBacks

trello-callbacks.js

  • Get the board details using getBoard, use the board id to get lists from getLists for the list id qwsa221.
  • Get board -> lists -> cards for list qwsa221 and cards for list jwkh245 simultaneously
  • Get board -> lists -> cards for all lists simultaneously

Consuming existing Promises

Consuming existing promises trello-promises.js

  • Get the board details using getBoard, use the board id to get lists from getLists for the list id qwsa221.
  • Get board -> lists -> cards for list qwsa221 and cards for list jwkh245 simultaneously
  • Get board -> lists -> cards for all lists simultaneously

Creating Promises

Building your own promise based functions. First, solve it using promises. Then, refactor all solutions using async await.

Task 1: Right now, the function fetchRandomNumbers can be used by passing a callback, Your task is to promisfy this function so that the following can be done:

fetchRandomNumbers().then((randomNum) => { console.log(randomNum) });

Similarlly, do the same for the function fetchRandomString

Task 2: Fetch a random number -> add it to a sum variable and print sum-> fetch another random variable -> add it to the same sum variable and print the sum variable.

Task 3: Fetch a random number and a random string simultaneously, concatenate their and print the concatenated string

Task 4: Fetch 10 random numbers simultaneously -> and print their sum.

Async await

Task 1: Complete the function userDataSerial. Send a login request for user1 -> get user profile data -> get user posts data

Task 2: Complete the function userDataParallel. Send a login request for user1 -> get user profile data and get user posts data simultaneously

javascript-async's People

Contributors

learning-dev avatar sachinmk27 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.