title: javascript/jquery passing variables
body: <p>I was wondering if there is a way that I can pass variables like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  width = 300;
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  (function(){
      var k = width;
      alert(k);
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm trying to learn how I can pass width into the variable k. I dont want to do <code>var width =300</code> Is there a way to do such a thing like this? so eventually I can place the bottom script, <code>(function(){...});</code> into a file where I can just do this</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  width = 300;
  
  //more variables if needed
  
  //height = 300;
  //name = "example";
  //...
  &lt;/script&gt;
  
  &lt;script type="text/javascript" src="thefile.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>So I can add more variables if I have to</p>
  
  <p>Thanks!</p>