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

263
Views
Async await promises error no outputs shown

I was learning JS specifically promises with async await and faced an issue while implementing await and async , I am not getting my output. SO what i I was trying to do is that I want to do task Task1 : print the rollnumber array after 2 sec task 2 : passing rollnoarr[1] and printing the object created.

Kindly help me out with my code. Thank you.

const pobj1 = () => {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      let rollno = [1, 2, 3, 4, 5];
      resolve(rollno);
    }, 2000);
  })
}

const getBiodata = (indexdata) => {
  console.log("getbiodata called");
  return new Promise((resolve, reject) => {
    setTimeout((indexdata) => {
      const mydata = {
        name: "Harshit",
        age: 22
      }
      console.log(`my name is ${mydata.name} and my age is ${mydata.age} and my rollno is ${indexdata}`);
    }, 2000, indexdata);
  })
}

const callMe = async() => {
  const obj1 = await pobj1();
  console.log(obj1);

  const obj2 = await getBiodata(obj1[1]);
  console.log(obj2);
}
callMe();

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!