Question
Help! I’m stilling getting an error and an undefined
, even though I’m using this
and template literal syntax correctly. What’s wrong?
Answer
Ahh, interesting! Is your sayHello
function still in arrow function format? Arrow functions do not have a context object, and therefore no this
, like ordinary functions and methods do. In the previous lesson, we learned about the ES6 method syntax. Try refactoring your function and see what happens.