The following JavaScript updates my firebase:
db.collection("users").doc(user.uid).update({
img1: pic
});
I have img1, img2, img3 in my database. I want to use a for loop to update the values like so:
for (let i = 1; i <= 3; i++) {
let s = "img" + i;
db.collection("users").doc(user.uid).update({
s: pic
});
}
Unfortunately this does not work. Is there another way to achieve this?