Wait for the function to return the result

function abc () {

: 1  0

}

var aaa = abc ();
when executed in this way, aaa is undefined

ask the teacher how to get the correct return value. Thank you

May.06,2021

bind events in user actions


the context is so unclear that it is recommended that callbacks can be used:

function abc(callback){
    // result 
    callback(result)
}

function callback(result){
    console.log(result)
}

I guess the abc () function of the landlord is an asynchronous function. Then you want to return data in this asynchronous function, only to find that it is undefined .

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-1bf6fe3-3205a.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-1bf6fe3-3205a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?