Why do arrow functions take precedence over function declarations in JavaScript Classes?
Example :
class Parent {
work = () => {
console.log('This is work() on the Parent class');
}
}
class Child extends Parent {
work() {
console.log("This is work() on the Child class ");
}
}
const kid = new Child();
kid.work();
The parent work() method fires in this example :
"This is work() on the Parent class"
I just want to understand WHY the arrow function always takes precedence in JS Classes, especially in regards to Inheritance and Polymorphism.