SyntaxError: Unexpected identifier in E:\i\todolist-nithishtry\views\list.ejs while compiling ejs

Viewed 15

code:

<% newitems.forEach(function(item){%>
  <div class="item">
    <input type="checkbox" />
    <p>
      <%= item.name %>
    </p>
  </div>

  <% });%>

by using for loop i got the required output when i tried to use for each loop i got error

code used for for loop

   <%for(var i=0; i<newitems.length; i++){%>
          <div class="item">
          <input type="checkbox"  >
          <p><%= newitems[i].name %></p></div>
        <%}%> 
0 Answers
Related