Why is this undefined?


const person = {

  name: "Taylor",

  sayHello() {

     `Hello! My name is ${this.name}.`;

  }
};
console.log(person.sayHello())

Why does this function come back undefined?

Your function should return something. The only time you can skip the return keyword is with single line arrow functions.

ahhh. Thanks. Learning… if that is not obvious :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.