Huh?


#1

https://www.codecademy.com/courses/learn-javascript-classes/lessons/classes/exercises/method-calls?action=lesson_resume&course_redirect=introduction-to-javascript


#2

Which step are you stuck on, and what do have for code, so far?

The like is for including the link. Thank you.


#3

class Surgeon {
constructor(name, department) {
this._name = name;
this._department = department;
this._remainingVacationDays = 20;
}
get name() {
return this._name;
}
get department() {
return this._department;
}
get remainingVacationDays() {
return this._remainingVacationDays;
}
takeVacationDays(daysOff) {
this._remainingVacationDays -= daysOff
}
}

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

console.log(‘Curry’,‘Cardiovascular’);


#4

having issues printing the value saved to thename property of the surgeonCurry object.


#5

It should be console.log(surgeonCurry.name);


#6

@j-smiles in your code above the console.log() takes in 2 arguments :wink:

console.log("Curry", "Cardiovascular");
//and returns 2 separate strings, not a concatenation
//Curry Cardiovascular

Breaking down task 1:

With the surgeonCurry instance created in your code we can access the properties of the constructor method

const surgeonCurry = new Surgeon("Curry", "Cardiovascular");

and save save these new values to an instance object surgeonCurry.

which can later be called like so

console.log(surgeonCurry.name);
//Curry

#7

ops! seen my mistake…Thanks