title: object key is not defined javascript/ejs
body: <p>I have an array called posts and it contains an object:</p>
  <pre><code>var posts = []
  
  app.get('/', function(req, res) {
      res.render('home', {
          homestct: homeStartingContent,
          posts: posts
      })
  })
  
  app.post('/compose', function(req, res) {
      const comp = {
          title: req.body.compTitle,
          post: req.body.compPost
      }
      posts.push(comp)
      res.redirect('/')
  
  })
  </code></pre>
  <p>and when I try to retrieve the key: title in home.ejs =</p>
  <pre><code>    &lt;% for (var i = 0; i &lt;= posts.length; i++) { %&gt;
          &lt;% console.log(posts[i].title) %&gt;
              &lt;% } %&gt;
  </code></pre>
  <p>it gives me thee error: Cannot read property 'title' of undefined</p>
  <p>Please help T_T</p>