To override a public property on a subclass in JavaScript, you can do the following:
index.tsx86 chars6 lines
index.tsx108 chars7 lines
super()
to invoke the parent class's constructor and inherit its properties. Then, override the parent class's propertyToOverride
property with a new value.Now, if you create an instance of the Child class, you can access propertyToOverride
which will return the overridden value 'newValue'.
index.tsx88 chars3 lines
gistlibby LogSnag