Let's take a look at the Promise API.
4 methods explained with examples below.
🧵👇
🔹 Promise.all()
The Promise.all() method takes an array of promises as an argument and returns a single Promise that resolves to an array of the results of the input promises.
🔹 Promise.allSettled()
The Promise.allSettled() method returns a promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects that each describes the outcome of each promise.
14 Array Methods that will make your life easier.
Explanation and examples below.
🧵👇
🔸 map
The map() method creates a new array populated with the return value of the callback function for each element in the array.
🔸 forEach
The forEach() method executes a provided function once for each array element.
The callback function does not expect a return value, and the forEach() method itself also returns undefined.