So I am working on a loop and I am wondering whats the recommended way to deal with situations where you are looping through a bunch of firebase storage items and you are going to use bunch of firebase child refs. I am using Node.js 12.18.2 and I am writing function for firebase cloud functions and I am going to loop through a bunch of files stored inside firebase storage and I wanna keep variable hoisting in mind while writing the code.
//should I put the ref here? and ofc, which one is better to use var or let?
let storageRef = firebase.storage();
var storageRef = firebase.storage();
item.forEach(element => {
// or use seperate storage ref for each firebase storage item
let storageRef = firebase.storage();
var storageRef = firebase.storage();
let storageRef.child("images/stars.jpg").getDownloadURL(); //bla bla bla
});
basically don't want the storage ref to somehow collide with each other. what's the best option?