title: OOP - Is it standard to define a class with only static methods or to define a class which only has one instance?
body: <p>I have a class that only requires one instance in my code. Is it better (and convention) to stick with the regular class, constructor and only create one instance of the class or to directly use the class without creating any instances by using static methods and properties?
  Something like this:</p>
  <pre><code>class Foo {
    constructor() {
      this.bar = []
    }
    foobar(x) {
      this.bar.push(x)
    }
  }
  
  let foo = new Foo()
  </code></pre>
  <p>Or like this:</p>
  <pre><code>class Foo {
    static bar = []
    static foobar(x) {
      this.constructor.bar.push(x)
    }
  }
  </code></pre>
  <p>The second one takes up less space, but I'm not sure whether it adheres to OOP conventions.</p>