How can we implement a parent class with static methods that access a property defined in the child class using JavaScript? Below is an example code snippet illustrating this concept:
class Parent {
static greet() {
return `Hi ${this.username}!`;
}
}
class Child extends Parent {
static username = "Jim";
}
Child.greet();