Skip to content

Instantly share code, notes, and snippets.

View alex-shamshurin's full-sized avatar

Alexander Shamshurin alex-shamshurin

  • SIT Development
  • Moscow
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.");