Question: JS questions Using async/await syntax write a set of functions that adds numbers and awaits for the total. Requirements - Use async/await syntax - Use
JS questions
Using async/await syntax write a set of functions that adds numbers and awaits for the total. Requirements - Use async/await syntax - Use Promise with setTimeout() in adder() function. - adder(previous, next) This function accepts the previous number and the next number. It resolves a Promise after 10ms to return the new total. You can assume that adder starts with it's intial previous as 0 (which can be hard coded).
- iterateNumbers(numbers) This function accepts an array of numbers to be totaled. It prints the total when all numbers have been added.
``` iterateNumbers([1, 2, 3, 5, 8, 13, 21]) // Total: // 53
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
