JS is different than some languages. In some languages, you would create setters and getters as methods like “setWriter” and “getWriter”, and that is how you would access them, like:
const writer = myBook.getWriter();
But JS doesn’t do it that way. You define the methods with the “get” and “set” keywords (as you’ve done above) and you just access the setter and getter as you would a property:
const writer = myBook.writer;
myBook.writer = 'Someone Else';
and JS just knows to use the getter for the first one and the setter for the second one, because of context. The code above doesn’t know that it is using a getter and setter, and it doesn’t care.
I understand the usage of getter and setter, but in this example, where are we getting the “writer()” from?
In short, that name “writer” is the name of the “pseudo property” you will be accessing in the code. Again, we just access
myBook.writer and JS knows whether it is a standard property, and if not, it knows to use the setter or getter.