title: Why the resize event only fires once
body: <p>I am trying to make a function run every time the "resize" event fires out. 
    But there is something that prevents it from happening. When I write an anonymous function and console log something when the event 'resize' fires - it works. Help me understand why this may could have happened.</p>
  
  <pre><code>window.addEventListener("resize", getNumberOfShelves(arr, width));
  
  function getNumberOfShelves( arra, w ) {
   if(wrap.firstChild) {
      wrap.removeChild(wrap.firstChild);
   }
   if(w &gt;= 1126) {
       var numberOfBooks = 4;
       var arrayOfArrays = [];
  
       for (var i=0; i&lt;arra.length; i+=numberOfBooks) {
            arrayOfArrays.push(arra.slice(i, i+numberOfBooks));
       }
  
       array1 = arrayOfArrays[0];
       array2 = arrayOfArrays[1];
       create(array1);
       create(array2);
  }
  </code></pre>