Try this;
sampleDataSet.forEach((d)=>{
console.log("Hello " + d.firstName + " " + d.lastName);
})
if sampleDataSet is an object then we can loop object as well;
for (let [key, value] of Object.entries(sampleDataSet)) {
console.log("Hello " + value.firstName + " " + value.lastName);
}
database.ref("collection").once("value").then((snapshot) => { snapshot.forEach((userSnap) => { console.log('hello ' + userSnap.child(`firstName`).val() + ' ' + userSnap.child(`lastName`).val() ); }); });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.