Are my hypotheses for constructor, variables, and iterators correct?


Here is the code:

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');

So here are the things I think will happen:

These refer to different ways to interpret takeVacationDays(daysOff)
Firstly, lets say the hospital has a vacation day algorithm that exponentially adds days. Especially for doctors, I could see this being a thing. It may be bad for business cause then the doctors would take vacation all the time :slight_smile:
Could I change the += to a ** at the end to exponentially add days? (if I have 3 days of leave, I get 9)
Could I change the += to -= ? to decrement normally would be --; in the example to increment the behavior is ++ (the dog example that you can navigate to on the website). I don’t understand the role of – here instead of -=;
or if I wanted to divide (i.e., if I have 4 days of leave, I only get 2)
I guess why -=? Would just a re
A different question:
With constructor methods, is it not neccesary to declare a variable before just mentioning it. My hypothesis is that you could declare a variable inside the get method, but that seems like it is not working.

Let me just reiterate that I am just learning this stuff so yes, there is a gap of understanding. I’m not asking for the answer; these are concept questions

Hope to hear from you soon. I will be in and out for the next 2-3 days but I am certainly interested in this discussion.

Sites about the research I have done:
operators and W3 schools
the lesson

I will likely post somewhere else if I cant get these answers, but I’m hoping to learn more about these concepts from you friendly guys!

I really enjoy this site even though the exercises are so tough :dizzy_face: