The processing of the result value returned by javascript asynchronously

clipboard.png
Boss, I want to finally get a return value. Instead of a promise, you can understand the two functions above as the asynchronous return of the request interface

.

The

async function returns a Promise object.
async the value returned by the return statement inside the function becomes the parameter of the callback function of the then method.

async function f() {
  return 'hello world';
}

f().then(v => console.log(v))
// "hello world"

const onefunc = async () => {
    return await new Promise( resolve => {
        setTimeout(()=>{
            resolve("");
        }, 1000);
    });
}

const getData = async () => {
    let data = await onefunc();
    console.log(data);
    return data;
}
getData();

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdd405-31365.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdd405-31365.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?