title: Why is JavaScript not recognizing my function?
body: <p>I am creating a class in JavaScript, in that class I created a few functions however only the constructor seems to work. What am I missing because I did another class in the same exact format and it worked perfectly.</p>
  <pre><code>class Articles {
      constructor(dbName = ':memory:') {
          return // Some async function  
              return this
          })()
      }
      async all() {
          //another async function
          }
          return articles
      }
      async add(data) {
          console.log('ADD')
          console.log(data)
          return true
      }
      async close() {
          await this.db.close
      }
  }
  export default Articles
  </code></pre>
  <p>I have taken out the parts that I dont think are necessary just so that its easier to read.
  The issue I have is with the last two functions add and close.
  The class exports fine.
  <a href="https://i.stack.imgur.com/si8cQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/si8cQ.png" alt="This is the type error that I keep getting" /></a></p>
  <p>Here is the function that I run it in</p>
  <pre><code>router.post('/add', async ctx =&gt; {
      const a = await new Articles(dbName)
      try{
          ctx.request.body.account = ctx.session.userid
          }
          await new Articles(dbName).add(ctx.request.body) //Here is the add function
          return ctx.redirect('/?msg=new article added')
      } catch(err) {
          console.log(err)
          await ctx.render('error', ctx.hbs)
      } finally {
          new Articles(dbName).close() //Here is the close function
      }
  })
  </code></pre>