title: checking array length in switch statement
body: <p>I am looking at using a <code>switch</code> statement to check if an array's length is greater than <code>0</code>. I could do this using an <code>if/else</code> statement but I want to get more comfortable using <code>switch</code> statements and am slightly baffled why the following doesn't work.</p>
  
  <p>Given an array of numbers, my function determines whether the sum of all of the numbers is odd or even.</p>
  
  <p>Here is what it looks like:</p>
  
  <pre><code>function oddOrEven(array) {
  
     switch(array) {
       case array.length === 0: 
         throw 'Error';
         break;
  
      case array.length &gt; 0:
         answer = array.reduce((a, b)=&gt;{
           return a + b;
         }) % 2 === 0 ? 'even' :  'odd'; 
         break;
     }
  }
  </code></pre>
  
  <p>examples</p>
  
  <pre><code>oddOrEven([0]) returns "even"
  oddOrEven([2, 5, 34, 6]) returns "odd"
  oddOrEven([0, -1, -5]) returns "even"
  </code></pre>
  
  <p>I know I can do <code>if(array.length &gt; 0)...</code> but as I said I want to get used to using switch statements and thought that this should also work.</p>