why is this recursive catch sometimes being undefined for thethen parameter?

When you recursively call responseToTom() from the .catch() handler, you are relying on the fact that responseToTom() will return a promise that resolves to a value. But, in this code:

    .then((greet) => {
        if (greet == undefined){
          console.error("Ups undefined")
        }
        console.log(greet)
    });

You aren’t returning any value so that will always resolve to an undefined value. You probably want to add return greet to that .then() handler.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top