Skip to content

Instantly share code, notes, and snippets.

View telefonosuci's full-sized avatar
🏠
Working from home

Enrico Succhielli telefonosuci

🏠
Working from home
  • Alpenite
  • Arezzo
View GitHub Profile
'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");