Hello everyone, I'm currently working on a new JavaScript project and I've encountered an issue. I need to figure out how to change variables in anonymous functions. Can anyone help me with this?
updateName : function(){
var firstName = "Alexander";
if(true)
{
db.transaction(function(transaction){
firstName = "Stephane"; // How can I update the value of [firstName] at this point?
transaction.executeSql('SELECT * FROM users',[]);
});
}
return firstName; // Instead of returning Stephane, this function returns Alexander
},