function yourfunction(...) {
return new Promise((resolve, reject) => {
// some code success
resolve(result);
// some code fails
reject("some error");
});
}
// in ur code
yourfunction(...).then(result => console.log(result)).catch(err => console.error(err));
(edited)query(...)
async