title: Dealing with a non-existent variable in JavaScript
body: <p>I am loading in a property from some PHP code using mustache as below:</p>
  
  <p>PHP:</p>
  
  <pre><code>$data['foo'] = getFooAsJSON();
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>var bar = &lt;%&amp;foo%&gt;;
  </code></pre>
  
  <p>The issue here is that when &lt;%&amp;foo%> is sometimes non-existent and so the JS becomes:</p>
  
  <pre><code>var bar = ;
  </code></pre>
  
  <p>throwing syntax errors. I want to assign bar to be <code>null</code> as a fallback but given that <code>&lt;%&amp;foo%&gt;</code> returns nothing, I'm not sure how to do this without invoking syntax errors.</p>
  
  <p>Any ideas?</p>