const promise1 = new Promise((resolve) => setTimeout(resolve, 100, 'quick'));
      const promise2 = new Promise((resolve) => setTimeout(resolve, 500, 'slow'));
      const promises = [promise1, promise2];
      Promise.any(promises).then((value) => console.log(value));

      Javascript language logo
      promises any

      My JavaScript recipes

      Take the first promise that resolves

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.