Question: 1. (30 points). You are given a set of asynchronous, non-blocking tasks. Each task will call a supplied callback when it finishes executing. You are

 1. (30 points). You are given a set of asynchronous, non-blocking

1. (30 points). You are given a set of asynchronous, non-blocking tasks. Each task will call a supplied callback when it finishes executing. You are to write a function, called roundAndRound, that takes as arguments the set of tasks, an integer 'rep', and two callbacks. Review the code below: let tasks = [taska, taskb, taskc, taskD]; let perRound = (i) => I console.log('Done with round: ' + i); }; let allDone = ( ) => { console.log('Done with everything'); roundAndRound (tasks, 7, perRound, allDone); You need to execute every task 'rep' number of times. So for the example above, every task is going to be executed 7 times. But, we want to execute the tasks is rounds, i.e. run every task once, when they are all done, then run all of the tasks again, over and over. At the end of each round we call the first callback, and the end of all of the runs we call the second. Said in pseudocode: for i - i to rep: start all tasks wait for all tasks to complete call first callback call second callback Obviously, just translating the pseudocode to Javascript is really not going to work. Implement roundAndRound below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!