School Catalogue Help! - My setter and method not working but I can't understand why

Hi I’m working on the School Catalogue project in the Javascript class. I can’t seem to get my setter working and the substituteTeachers method. I keep double checking my code and I can’t figure out what I am doing incorrectly. Here is the link to my code

The setter code I thought I even followed the expert video, but when I test it it is not working. Am I calling the function incorrectly? Please help. Thank you very much in advance

setters are not functions, setters overwrite assignment behavior for a given property in an object.

1 Like

Thanks for the clarification. Why is it when I try to call my object test and reassign the numberOfStudents it does not work?

Can you show code of this? Now i don’t know what you have done

i created at bottom an object test to see if the setter numberOfStudents was working correctly. when i logged it to the console it was fine but when i tried to reassign the numberOfStudents it returned an error.

you don’t do any assignment? You attempt to call a method, but a setter is not a method (well, i suppose technically it is), but it shouldn’t be called as one.

a setter is “magically” called when you do assignment. Have you tried to use assigning to the setter?

Ohhhhh. I see now. Thank you very much. I revised it and that works. Appreciate your help stetim94