I discovered today that this seems to be legal javascript:
class foo {
a() { console.log( 'a' ); }
b() { console.log( 'b' ); }
a() { console.log( 'a2' ); }
}
( new foo() ).a(); // shows a2
The a()
function is listed twice, but javascript just ignores the first one. Why is this legal? What is a meaningful use case for this "feature"?