Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
How to return data outside of async

Im trying to change the value of a variable outside a map but i need the map to be an async so that i can use the await but it seemed after the map its not changing the value here is my code

let firstFilter = []
    Object.keys(filter).map(async(key, index)=>{
        if (index == 0) {
            options.push(where(key,'in',filter[key]))
            const q = query(collection(db, "Videos"),...options);
            const querySnapshot = await getDocs(q);
            const documents = querySnapshot.docs.map((doc) =>({ key_id: doc.id, ...doc.data() }));
            firstFilter.push(documents)
        }else{
            var number = firstFilter.filter((item,indexM)=>{
                if (filter[key].includes(item[key].toString())) {
                    return item
                }
            })
            firstFilter = number
        }
        options=[]
    })
    console.log("no data outside async", firstFilter);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!