0

in es6 a class can have methods and static methods as its members. can it also have classes as members? (because Class is actually kind of function itself?) i would like it to build nested classes.

class foo {
  barMethod {
    // do something for the instance
  }
  static bamMethod {
    // do something
  }

  // e.g.
  class batClass {
    // the constructor and other stuff for batClass 
  }

}

new foo.batClass();
mbehzad
  • 3,758
  • 3
  • 22
  • 29

1 Answers1

0

[No.] (Nested ES6 classes?). Read this post. You can only do as @floribon mentioned in comment.

Community
  • 1
  • 1
Artem Markov
  • 413
  • 3
  • 13