Build a Library project JavaScript

Hi all,

I’ve been going through the following project:
Build a Library

No matter how much I look at it or change it, it keeps showing the same error. Could anyone give me a helping hand? Probably I missed something I am not able to spot.



Thanks in advance for your help!

Hi there, welcome to the forums.

Take a careful look at your set function for isCheckedOut:slight_smile:

Oh thanks! I completely missed that one.

Although I see I could not use the “setter” due to the misspelling, I don’t understand the connection with the shown error, since I am accessing the “getter” in this case. When I call the .toggleCheckOutStatus method, does it also make use of the “setter”?

Thanks!

1 Like

Ah, but you’re not only using the getter here…

JavaScript is giving you an error with this statement:

this.isCheckedOut = !this.isCheckedOut;

This is an assignment operation so, whilst the RHS of your assignment will be using the getter in order to compute the not operator against the existing value, the setter is required to put that value back in to the attribute _isCheckedOut.

As the setter has a typo, JavaScript can’t use it and so you get the error.

Does that make sense? :slight_smile:

Oh, now it makes sense to me!

Thank you very much for your help, I really appreciate it!

1 Like

No problem. :slight_smile:

If you find yourself stuck on anything else, pop back and ask us. :smiley:

1 Like