CLASSES Method Calls 5/12


#1
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(surgeonCurry.name);
surgeonCurry.takeVacationDays(3);
console.log(surgeonCurry.remainingVacationDays); // 20    <--- Is that right?? I can't understand the sens of it, if we use surgeonCurry.takeVacationDays(3), which takes 3 from 20, i expected to see 17!

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


#2

you do the subtraction, but you do nothing with the result this subtraction gives you


#3

anyway, for education is it enough or i need to remake something? i don’t mind to remake something…

anyway, thanks for help-answer :slight_smile:


#4

I would do something with the result of the subtraction, so that the output is displayed correctly