title: Cannot read property 'length' of null in JavaScript
body: <p>I'm doing <a href="https://www.codewars.com/kata/averages-of-numbers/train/javascript" rel="nofollow noreferrer">this</a> challenge on codewars, it passed all the test but I got an error:</p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'length' of null</p>
  </blockquote>
  
  <p>so I can't past the challenge. Can anyone tell me what's wrong with this code ?</p>
  
  <pre><code>function averages(numbers) {
    for(var i=0; i&lt;numbers.length; i++){
      if(numbers.length &lt; 2 || numbers[i] === ""){
        return [];
      } else {
        numbers[i] = (numbers[i] + numbers[i+1]) / 2;
      }
    }
    numbers.pop();
    return numbers
  }
  </code></pre>