I want to assign the variable salary with the result of the promise. How can I do that?
host: hostName,
user: user,
password: password,
port: portNumber,
});
var salary;
function SelectSum (con) {
return new Promise ((resolve, reject)=>{
con.query("SELECT sum(salary) as sum FROM people'", (error, sum)=>{
if (error) {
return reject (error);
}
return resolve(sum);
})
})
}```