-2
How to declare the function below as Arrow Function in javascript Ecma 6 and then call it? Currently I use it like this and do not know how it leaves working without the "Function" in front.
execSQLQuery('DELETE FROM Usuarios WHERE idUser=' + parseInt(req.params.id), res);
function execSQLQuery(sqlQry, res){
const connection = mysql.createConnection({
host : 'localhost',
port : 3306,
user : 'joao',
password : '123',
database : 'dadosD'
})
connection.query(sqlQry, (error, results, fields)=>{
if(error)
res.json(error);
else
res.json(results);
connection.end();
console.log('executou!');
})
};
Why do you want to declare this function as Arrow Function?
– Andre