Skip to content
Advertisement

How can I display all data from Firestore documents into an html table

I am designing a web page that will obtain data from my firestore collection and display each document with its corresponding fields Here is the code:

JavaScript

here is the JS:

JavaScript

Advertisement

Answer

I don’t see why you’re using a for loop in your function. Unless one “Book” document is an Array of items each having the Title/Author/Points fields.

You’re basically looping through the data object as if it’s an array. Chances are, it’s not.

If I’m right, and one “Book” document is object/map containing those three fields, then your code should be like this:

JavaScript
Advertisement