El problema es que los valores de los comentarios de mis películas no están definidos en la tercera foto. Pero en consola funciona correctamente. Quiero acceder a mis comentarios y recuperarlos. ¿Cómo puedo hacer esto? (btnComment es la identificación de mis botones. TextComment es la identificación de la etiqueta de área de texto. Muestra la variable que proporciona la identificación de mi película. La identificación de mi película = 1)
btnComment.addEventListener('click', (e) => { var movieComment = document.getElementById('textComment').value; push(child(firebaseRef, 'Movies/' + show + '/Comments'), movieComment) { movieComment: movieComment }; }); get(child(firebaseRef, `Movies/` + show + '/Comments')).then((childSnapshot) => { if (childSnapshot.exists()) { console.log(childSnapshot.val()); } else { console.log("error"); } }) var body2 = document.getElementById('detail2'); function AddItemsToTable2(comment) { const comments = ` <td>Alan Smith</td> <td><i class="fa fa-star" style="color:green"></i></td> <td>${comment}<h6>[May 09, 2016]</h6></td> `; html = comments; body2.innerHTML += html; } function AddAllItemsToTable2(TheComments) { body2.innerHTML = ""; TheComments.forEach(element => { AddItemsToTable2(element.movieComment); }); } function getAllDataOnce2() { var show = qs["movieId"]; get(child(firebaseRef, `Movies/` + show + '/Comments/')).then((childSnapshot) => { var comments = []; comments.push(childSnapshot.val()); AddAllItemsToTable2(comments); }); } window.onload = (event) => { getAllDataOnce2(); };