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

57
Views
How to access a method within a async function within a same class in Javascript

I am trying to access MethodA within an async function inside MethodB, which is not accessible. But if i am trying outside async function it is working as expected. Below is the example.

Options tried and not working:

  1. Used this.methodA()
class A{
constructor(){
}

async methodA(){
//Do something here
}

async methodB(){
await methodA(); //methodA is accessible in this line
await browser.getCurrentUrl().then(async function(){
await methodA(); //methodA is NOT accessible in this line
});
}
}

module.exports = new A(); //Using this to make the methods available in other places
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!