title: variable used out of scope
body: <p>I'm doing a responsive background video. I have this code.</p>
  
  <pre><code>&lt;video id="bgvideo" /&gt;
  
  function scaleVideo() {
  
      var windowHeight = $(window).height();
      var windowWidth = $(window).width();
  
      var videoNativeWidth = $('video#bgvideo')[0].videoWidth;
      var videoNativeHeight = $('video#bgvideo')[0].videoHeight;
  
  
      var heightScaleFactor = windowHeight / videoNativeHeight;
      var widthScaleFactor = windowWidth / videoNativeWidth;
  
  
      if (widthScaleFactor &gt;= heightScaleFactor) {
          var scale = widthScaleFactor;
      } else {
          var scale = heightScaleFactor;
      }
  
      var scaledVideoHeight = videoNativeHeight * scale;
      var scaledVideoWidth  = videoNativeWidth * scale;
  
      $('video#bgvideo').height(scaledVideoHeight);
      $('video#bgvideo').width(scaledVideoWidth);
  }
  </code></pre>
  
  <p>I'm using grunt to compile my code and etc.
  Jshint of grunt is saying I'm using "scale" out of scope and I cant understand why.</p>
  
  <p>Any suggests ?</p>
  
  <p><img src="https://i.stack.imgur.com/fXCrs.jpg" alt="error"></p>