Why does set not work here?

Tell us what’s happening:
I’m playing around and experimenting with getters and setters and found that setters don’t work in this example, the word set has a squiggly red underline.

why is this so? How do I fix it?

Your code so far


let book = 
{
  _author: 'Dahl',


get writer() {
  return this._author;
}

set writer(updatedAuthor) {
  this._author = updatedAuthor;
}
}

console.log(book.writer) // Dahl

console.log(book.writer = 'Tolkien') 
console.log(book.writer) 

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36.

Challenge: Use getters and setters to Control Access to an Object

Link to the challenge:

Hi @Josep

it’s a syntax error. it’s complaining about the lack of a comma at the end of your getter. Put a comma after the getter’s closing bracket },