var seat;
var emp = db.collection('BookedTicketData').get().then((snapshot) => {
snapshot.docs.forEach((doc) => {
var data = doc.data()
console.log(data.AllSeat);
seat = data.AllSeat
})
})
seat.forEach((val) => {
for(i = 1; i<=37;i++){
if(val == i){
html += `
<input type="checkbox" class="dn checkme" name="s-size" id="${j}" value="${j}"/>
<label for="${j}" class="col-2 br-pill f7 m-1 btn text-dark bg-white border-dark grow">${j}</label>
`
}
}
})
document.getElementById('loader').innerHTML = html;
I have applied this code to get the value of seat from firebase and it is an array i am matching those value with a loop but i am getting undefined the value of seat outside that function.