JavaScript Class inheritance - Supertype properties with initial values


Reaching out for a technical answer. I’ve covered classes, which are to some degree syntactic sugar for traditional constructor functions - which I’ve covered already elsewhere so its nice to see how instancing objects is made somewhat easier with ES6 - and subsequently comparing this to factory functions in which the main difference seems to be that they don’t have inheritance baked in (correct me if wrong).

The one item i need to gloss over in classes, are super-types and the relationship to a sub-type, specifically the super() function we use to call out to the super-type. here, i need to understand why we don’t call out for properties from the super-type that are set with initial values, for example:

class Employee {
     constructor(name, age) {
          this._name = name;
          this._age = age;
          this._salary = 0 /* <-- */

class Professor extends Employee {
      constructor(name, age, lectureCount) {
            super(name, age) /* <-- salary not referenced */
            this._lectureCount = lectureCount;

So (sub-type) class Professor extends (super-type) Employee. in Professor class we use super() function to call to Employee class to set these properties, but we don’t make reference to the initially set salary property. i know any methods here would also be inherited without needing to be directly referenced, but we don’t seem to reference salary while we do the others.

My take is that because salary property already has an initial value, there is no need to specify it when calling out to super-type when actually creating an object, and given in this example it is designated as a private property, we would set or get the value using setters and getters when needed on the object instance.

If i have answered my own question then very well, but the fact i cannot find a similar post on the web about this makes me believe I’ve yet to be able to formally explain this using the right jargon.