Monday 12 July 2021

how can we combine synchronous function, callback function and promise all together

If I have three types of functions.

  1. synchronous function

    function a(){ return "a"; }

  2. callback function

    function b(callback){ setTimout(callback(b), ) setTimeout(() => { callback(b); }, 10); }

  3. Promise function.

    function c(){ return new Promise.resolve('c') }

How can we combine the result of all 3 in a single promise. like Can we create a function, which can return ['a', 'b', 'c']; I do not want to change these three functions.

how can we combine synchronous function, callback function and promise all together



from how can we combine synchronous function, callback function and promise all together

No comments:

Post a Comment