title: Cannot read property 'length' of null when calling .length
body: <ul>
  <li><p>I have programmed a small function which takes in x's and o's. If there are the same number of each letter in a string, the function returns true </p></li>
  <li><p>My problem is I am trying to get this test to pass in <code>code wars</code> and the tests are returning:</p>
  
  <p>TypeError: Cannot read property 'length' of null at XO</p></li>
  </ul>
  
  <p>Why is this the case? What can I do to resolve this?</p>
  
  <pre><code>    function XO(str) {
        x = str.match(/[x]/gi).length
        y = str.match(/[o]/gi).length
  
  
  
         return x == y ? true : false 
      }
  </code></pre>