title: How do I define global variables in CoffeeScript?
body: <p>On Coffeescript.org:</p>
  
  <pre><code>bawbag = (x, y) -&gt;
      z = (x * y)
  
  bawbag(5, 10) 
  </code></pre>
  
  <p>would compile to:</p>
  
  <pre><code>var bawbag;
  bawbag = function(x, y) {
    var z;
    return (z = (x * y));
  };
  bawbag(5, 10);
  </code></pre>
  
  <p>compiling via coffee-script under node.js wraps that so:</p>
  
  <pre><code>(function() {
    var bawbag;
    bawbag = function(x, y) {
      var z;
      return (z = (x * y));
    };
    bawbag(5, 10);
  }).call(this);
  </code></pre>
  
  <p>Docs say:</p>
  
  <blockquote>
    <p>If you'd like to create top-level variables for other scripts to use,
    attach them as properties on window, or on the exports object in
    CommonJS. The existential operator (covered below), gives you a
    reliable way to figure out where to add them, if you're targeting both
    CommonJS and the browser: root = exports ? this</p>
  </blockquote>
  
  <p>How do I define Global Variables then in CoffeeScript. What does 'attach them as properties on window' mean?</p>