Why are derived class property values not seen in the base class constructor? : <p>I wrote some code:</p>

<pre><code>class Base {
    // Default value
    myColor = 'blue';

    constructor() {
        console.log(this.myColor);
    }
}

class Derived extends Base {
     myColor = 'red'; 
}

// Prints "blue", expected "red"
const x = new Derived();
</code></pre>

<p>I was expecting my derived class field initializer to run before the base class constructor.
Instead, the derived class doesn't change the <code>myColor</code> property until after the base class constructor runs, so I observe the wrong values in the constructor.</p>

<p>Is this a bug? What's wrong? Why does this happen? What should I do instead?</p>
