Java Reference
In-Depth Information
{ name: "Go for a run" },
{ name: "Finish writing last chapter" },
{ name: "Phone bank" },
{ name: "Email Craig" }
Mustache implements “logic-less” templates that don't require any lines of logic to be ex-
plicitly written in JavaScript; instead, it is inferred from the context. This is how it would
iterate over the task array to display a list of tasks:
EJS uses more explicit JavaScript coding to achieve the same result. Each line of JavaScript
code is placed inside the special <% %> tags. If any values need to be evaluated, they are
placed inside <%= %> instead:
<% tasks.forEach(function(task) { %>
<li><%= %></li>
<% }); %>
<% } %>>
Both of these templates would return this HTML code:
<li>Get Milk</li>
<li>Go for a run</li>
<li>Finish writing last chapter</li>
<li>Phone bank</li>
<li>Email Craig</li>
Search WWH ::

Custom Search