I'm using the following Fetch:
var bdresultados;
if(respuesta.context.bueno){
fetch('/bd/').then(response =>{
return response.json();
}).then(data => {
for(let indice of data){
bdresultados = indice.Personas;
}
}).catch(err => {
});
console.log(bdresultados);
}
The problem is that I need to use that variable var bdresultados
outside the fetch. How could I do it? Thanks