Hi I can't get the value of a specific index of an array. I don't know why because if I try to log the entire array it works but with a specific index it doesn't work
This is my code, I use cloud firestore to get the ID of a document and save it into array
var idUsers = [];
const users_list = document.querySelector("#users_list");
db.collection("utenti").get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
users_list.innerHTML += "<a href='utente.html' class='collection-item black-text'>" + doc.data().nome + " " + doc.data().cognome + " " + " </a>";
idUsers.push(doc.id);
});
});
console.log(idUsers);
console.log(idUsers[0]);
This is the result in Chrome console enter image description here