J'ai construit la fonction pour retourner une variable. Mais ma fonction utilise une autre fonction de manière asynchrone.portée variable dans la fonction asynchrone
function getVariable() {
var myVariable;
asyncronousFunction(function(...){
myVariable = ...
});
return myVariable;
}
Le problème est que myVariable
à l'extérieur et à l'intérieur de asyncronousFunction
sont des variables différentes. Donc, je ne peux pas attribuer de valeur à myVariable
de la fonction asynchrone.
Comment résoudre ce problème d'étendue? Merci.