0
I am trying to put the answer to an Axios request inside an array, but I am receiving as a response a strange structure, as I will show in the following image:
I created an Array, added my own name and soon after I tried to make a loop where I add the items referring to the Axios request response. But in response I get this structure from the image above, and the strangest thing, when I try to access from position 4 forward, it returns me "Undefined" Does anyone know what it can be?
Here is the code:
var nomes: Array<String> = [];
nomes.push("Abner")
nomes.push("Matheus")
nomes.push("Gomes")
nomes.push("Silva")
mat.map(r => {
Axios.get(`/pessoal/pessoa/${r}/buscarCursos`).then(response => {
nomes.push(response.data.toString())
})
})
console.log(nomes)