I’m getting an error that says `___ is not a function`. What’s wrong?


#1

Question

I’m getting an error that says ___ is not a function. What’s wrong?

Answer

Remember, while the syntax for calling a getter and a method are similar, you must include an opening and a closing parenthesis after your method names (e.g. user.sayHello()). Getters and setters don’t need the parentheses, because you are not calling the function itself but referring to the properties in your constructor, which are not functions.