My getter method creates an error


get {
return this._name;


Sorry, THIS is what creates the error:
get name() {
return this._name;


see here how to write a good post:

the error might hold related to other parts of your code, please include full code. What error message do you get? is also very useful information for people trying to help you

the exercise url would also be really useful, for quick access to troubleshoot the problem within the lesson.


This is the whole code that produces the error:

 class Surgeon {
  constructor(name, department) {
    this._name = name;
    this._department = department;
    this._remainingVacationDays = 20;

get name() {
 return this._name;

const surgeonCurry = new Surgeon('Curry', 'Cardiovascular');
const surgeonDurant = new Surgeon('Durant', 'Orthopedics');


The error says:
get name() {
SyntaxError: Unexpected identifier
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)


what about the exercise url?

well, the getter method should be of the class, this is currently not the case, you placed the getter method outside/after the class

see? I couldn’t have deduced that from just the getter code you posted originally.