Is it possible local variable value store as a instance var

Apr 22 2019 6:31 AM
Hi i want to display the function value to outside of the function only using variables.
I have a sql query function. I am getting the one value and stored in a variable. Now i want to this value stored in instance variable and display.
 
Note: I dont want using another function. only local variable value stored as a instance varible .Ho to solve this.
 
Iam using node.js code ::
 
if (intent.intent==='Sales-1'){
var rsp;
con.query('SELECT Mobiles from Salestb' , function (err,rows,field) {
if(err) {
throw err;
} else {
var value = (rows[0].Mobiles);
rsp =value;
}
});
console.log(rsp);
}

Answers (1)