title: How do i set a variable using conditional statements?
body: <p>This does not work, even though putting a simple print ("foo") in the function block does work. </p>
  
  <pre><code>&lt;script&gt;
  
  var viewportHeight = $(window).height();
  var X;
  
  $(function() {
  
      if (viewportHeight &gt;= 600) {
           var X = 100;
         }
  });
  &lt;/script&gt;
  </code></pre>