title: How to pass arguments to a function in a JS ES6 Class?
body: <p>I am trying to create some ES6 classes to clear my javascript code. I am unsure about the way to pass arguments to functions inside a Class.</p>
  
  <p>As I understood, the correct way is through the constructor but this would mean that they are bound once when I instanciate the class.</p>
  
  <p>In the following example i'd like to pass an element <code>elem</code> to my function <code>Categories.addCategory</code>.</p>
  
  <pre><code>    class Categories {
          constructor(id, name) {
              this.id = id;
              this.name = name;
          }
  
          getName() {
              return this.name;
          }
  
          getId() {
              return this.id;
          }
  
          addCategory(elem) {
              $(elem).addClass('category');
          }
      }
  </code></pre>
  
  <pre><code>Cat = new Categories(1, 'new products');
  Cat.addCategory('#product1');
  </code></pre>
  
  <p>I also wonder if there is another way to pass arguments rather than only using the constructor.</p>
  
  <p>Sorry if the question is unclear i'm fairly new to ES6 Classes and may have missed some core points.</p>