title: ExpressJS + EJS: Avoid "variable is not defined" globally
body: <p>How to globally avoid EJS throw error when context variable is not defined ? I mean a way to set (in middleware?) for example space or null value for all variables not defined. Now i always use on template something like below. Is better way ?</p>
  
  <pre><code>&lt;% if(typeof locals.variable != 'undefined') { %&gt;
   ... 
  &lt;% } %&gt;
  </code></pre>