How do I add a promise to the Cals constructor?

  • 0
    Tell me.
    How to add fetch's answer to the constructor. With the possibility of withdrawal?
    I teach classes.
    Or how to output fetch c class correctly.

    class Board {
      constructor() {
        // = result getReferral
      getReferral(url) {
        return fetch(url)
          .then(response => response.json())
          .then(data =>
    const ruler = new Board();
    const referral = ruler.getReferral();
    JavaScript Declan Kirk, May 7, 2019

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!