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

165
Views
How i can solve problem in Async function in javascript?

Please, can someone help me : I have problem with async function, I will save all object of async function in table pages, but in result I get empty table?

var pages=[];                                                    

function pdftoimg(url){
    var promise=new Promise(function (resolve,reject){
        pdfjsLib.getDocument(url).then((pdf)=>{
            length_files=pdf.numPages;
            for(var i=1;i<=length_files;i++){
                pdf.getPage(i).then((page)=>{
                    pages.push({pagenumber:i,pagedata:page});
                });
            }
            resolve();
        });
    });
    return promise;
}

console.log(pages)// get empty table []
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!