title: If not declared, declare the variable?
body: <p>The topic might be a bit cryptic, but here's my problem (perhaps a n00b-thing?):</p>
  
  <p>For my site I have a widget, that user can use on their site as such (for example):</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var widget_width ="300";
  &lt;/script&gt;
  &lt;script src="http://something/a.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Now, in the .js file I want to check if the user have declared the widget_width variable. So I thought I might do something like (I want the variable to be empty, "", because I do a server-side validation too):</p>
  
  <pre><code>if(typeof widget_width == 'undefined') {
      var widget_width = "";
  }
  </code></pre>
  
  <p>This didn't work, neither did:</p>
  
  <pre><code>if(!widget_width) {
      var widget_width = "";
  } 
  </code></pre>
  
  <p>Any ideas on how do declare a variable when needed this way? </p>