About how to write some JS

for example, if you want to write a callback, you can use promise:

 function a(){
    return new Promise(function(res,rej){
        res()
    }) 
 }
 
 a().then()

but now I want the code to run directly in the browser instead of going through webpack (ES6 to 5).

then use

var a = function(x){x();}
a(function(){
    console.log("")
})
//
Mar.29,2021

you can use es5. You can use polyfill to support promise,. There is no need to use callback writing, and the compatibility is good


.

now most modern browsers support Promise (after all, some browsers' API returns this), and you can also use some compatible libraries to support it.

as for your second way of writing, which is the most traditional callback , all I can think of is the pointing control problem of this .


there will be no problem, please rest assured to use it.

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