JS Asynchronous queue

has three execution functions. How to execute functions through an asynchronous queue so that they can be output in the order of parameters?
function f1() {
  setTimeout(function() {
    console.log("f1")
  }, 300)
}

function f2() {
  setTimeout(function() {
    console.log("f2")
  }, 100)
}

function f3() {
  setTimeout(function() {
    console.log("f3")
  }, 200)
}

function doWork(list) {
    // TODO
}

doWork([f1, f2, f3])

// : f1 f2 f3
May.29,2022

function f1() {
              return new Promise(function (resolve, reject) {
                setTimeout(function () {
                      resolve('f1');
                }, 300);
              });
        };
        // b
        function f2(data) {
              return new Promise(function (resolve, reject) {
                setTimeout(function () {
                     resolve(data + 'f2');
                }, 100);
              });
        };
        // c
        function f3 (data) {
              return new Promise(function (resolve, reject) {
                setTimeout(function () {
                      resolve(data + 'f3');
                }, 200);
              });
        };
        f1().then(function (data) {
            return f2(data);
        }).then(function (data) {
            return f3(data);
        }).then(function (data) {
            console.log(data);// abc
        });


function enque() {
   setTimeout(function() {
     f1();
   }, 0);
   setTimeout(function() {
     f2();
   }, 400);
   setTimeout(function() {
     f3();
   }, 500)
}

stupid method, ha

Menu