title: ES6 Classes/Object oriented and Event Handlers
body: <p>I've been learning the ins and outs of JavaScript and Object Oriented/Functional programming instead of writing hacky imperative code that while works....just is ugly and honestly not efficient.</p>
  
  <p>I was re-writing a tic-tac-toe game and am using Classes to implement the "Board" functions (Updating the board/checking tiles/etc...)</p>
  
  <p>and I realized.....where on earth should I be putting Event listeners (for buttons/tiles/etc...) in the page. I usually just put jquery <code>.click</code> functions in the <code>document.ready</code> scope, but that doesn't seem right.</p>
  
  <p>When I create a class with <code>new</code> would event listeners get attached or "readied"....I guess maybe I mis-understand how listeners work. And if they would work within a class as functions/methods? Or if it even makes sense to attach them there.</p>
  
  <p>For instance here is my base class right now (it's literally just set up so it's like bare minimum.</p>
  
  <pre><code>"use strict";
  
  class Board
  {
     constructor(playerIcon,compIcon) { 
          this.playerIcon = playerIcon;
          this.compIcon = compIcon;
  });
      }
  
      getTileContents(tile){
        return $("#tile-" + tile).text()
      }
  
      tileIsEmpty(tile){
          console.log($("#tile-" + tile).text())
        if($("#tile-" + tile).text() != 'X' || $("#tile-" + tile).text() != 'Y')
          return true
        else
          return false
      }  
  }
  
  let board = new Board('X','Y');
  </code></pre>
  
  <p>I thought maybe attaching the event listeners in the constructor would work? Since the constructor will be instantiated when new is called at least correct?</p>
  
  <p>Maybe it's just my misunderstand of how event handlers are handled or "bound" exactly?</p>
  
  <p>edit: Here is my pitiful tic-tac-toe so far for reference: <a href="http://codepen.io/msmith1114/pen/qmNevg" rel="nofollow noreferrer">http://codepen.io/msmith1114/pen/qmNevg</a></p>
  
  <p>(This is what im talking about in regards to the board)</p>