Why is the following code does not work for me?
I tried to run:
this._remainingVacationDays-daysOff = this._remainingVacationDays;
Isn’t is supposed to be the same as:
this._remainingVacationDays -= daysOff
Im doing number 2 and this is what i did.
constructor(name, department, remainingVacationDays) {
this._name = name;
this._department = department;
this._remainingVacationDays = 20;
Can anyone show me what i did wrong?
Can you explain this further? I feel like I am missing something here or maybe I forgot something (or some things) from previous lessons. Why is this._remainingVacationDays - daysOff; an expression and this._remainingVacationDays -= daysOff; a statement? I feel like they should do the same thing. Is there something that I can further read to have a deeper understanding of this or maybe I need to be referred to a past lesson? I feel like I will have a lot of trouble with this in the future. I appreciate your response in advance.
Thank you! I appreciate your response and I believe I have a better understanding from your explanation. So I am very grateful for that. I am not sure that was made exactly clear to me on previous lessons in the introduction to JavaScript course. I don’t even know what lesson to go back to in order to confirm that assertion but I certainly feel like I should revisit it in case there is something else I may have missed there. Otherwise I do feel quite confident in what I have learned so far. I just hate moments where I feel like I have a fundamental misunderstanding of something as I continue on my journey of learning and hopefully perfecting this scripting language.
Hi;
it would be a weird request, but is somewhere in google to find an easy application that used of JavaScript programming, to see how functions and methods and… works?
Because I’m learning abstractly, so are elusive, but real easy application would be very helpful.
gratefully
martinmiciciday
A setter will arbitrarily set to the new value, with no reason given. takeVacationDays is an explicit method that needs no further description. It is self-describing.
Technically, we could have a setter, then invoke it from within the above method. It doesn’t change much…