title: EJS and Node, EJS throws an error if passed in object does not exist?
body: <p>I am trying to pass a message object to a template using ejs.  My route code is as follows:</p>
  
  <pre><code>app.get('/', function(req, res) {
      res.render('index.ejs', {message: 'A message'});
  });
  </code></pre>
  
  <p>In my ejs (index.ejs) file, I have:</p>
  
  <pre><code>    &lt;% if (message) { %&gt;
          &lt;div class="alert alert-danger"&gt;&lt;%= message %&gt;&lt;/div&gt;
      &lt;% } %&gt;
  </code></pre>
  
  <p>But when I do not pass an object at all (not just <code>message: ""</code>) it returns the following error:</p>
  
  <pre><code>ReferenceError: /Users/Documents/node/views/index.ejs:13
      11| &lt;body&gt;
      12|     &lt;div class="container"&gt;
   &gt;&gt; 13|         &lt;% if (message) { %&gt;
      14|             &lt;div class="alert alert-danger"&gt;&lt;%= message %&gt;&lt;/div&gt;
      15|         &lt;% } %&gt;
      16|         &lt;div class="jumbotron text-center"&gt;
  
  message is not defined
  </code></pre>
  
  <p>Similarly, if I try <code>if(message.length &gt; 0)</code> but that just gives me the same error.  I thought the whole point of an <code>if</code> statement would be that the if <code>message</code> doesn't exist, it just skips.  How can I just make ejs render nothing if the message object is not passed or do I have to pass an empty <code>message</code> obect each time?</p>