I am experimenting with async/await, I can't understand why this line :
resolvedValue = await this.tryToSolve()
gives me this error :
Unexpected token this
class Test {
 constructor() {
  this.method = 0
  this.checkLink()
 }
 async checkLink() {
  return new Promise((resolve, reject) => {
   let resolvedValue
   for (let i = 0; i < 3; i++) {
    this.method = i
    resolvedValue = await this.tryToSolve()
    if (resolvedValue) break
   }
   console.log(`Method ${this.method} did the trick.`);
   resolve(resolvedValue)
  })
 }
 tryToSolve() {
  return new Promise((resolve, reject) => { // Resolves if this.method==1
   console.log(`Trying to solve with method ${this.method}...`);
   setTimeout(() => {
    resolve(!!this.method ? `http://www${this.method}.someurl.com` : false)
   }, 1000)
  })
 }
}
const test = new Test()Does anyone know the correct syntax to store the result of an async method in a variable?
Thanks in advance.
 
     
    