Why doesn't try {} catch () {} execute?

try{
  setTimeout(()=>{
      d //
  })
  //c; // c is undefined  
}catch(e){
 console.log(e.message)
}
Apr.21,2022

because setTimeout is asynchronous, to get an exception in an asynchronous operation, you need to write the try catch in the asynchronous operation.


how can synchronous syntax catch asynchronous errors


   setTimeout(()=>{
      console.log('d')
    })

cannot output a single

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