How do I access the dados
variable from within function
? Example below:
var dados;
PagSeguroDirectPayment.getBrand({
cardBin: this.pedidoSoft.numCard,
success: function(response) {
dados = response;
},
error: function(response) {},
complete: function(response) {}
});
console.log(dados);
This code is printing undefined
on the console. I believe it's a variable scope problem. The variable being accessed inside is not the same as outside. How can I access this variable from within the function?