Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - function first() {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve(1);
- }, 3000);
- });
- }
- function second() {
- return new Promise((resolve, reject) => {
- resolve(2);
- });
- }
- //===================
- const awaiter = async (...fns) => {
- for (const x of fns) {
- console.log(await x());
- }
- };
- awaiter(first, second);
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment                    
                 
                    