I want to run loop in Firebase function sample data set:
I want to loop through it and print console.log hello
Output should be like:
CodePudding user response:
Try this;
sampleDataSet.forEach((d)=>{
console.log("Hello " d.firstName " " d.lastName);
})
CodePudding user response:
database.ref("collection").once("value").then((snapshot) => {
snapshot.forEach((userSnap) => {
console.log('hello ' userSnap.child(`firstName`).val() ' ' userSnap.child(`lastName`).val() );
});
});