EJS is a JavaScript templating engine that works much like Underscore.js and also uses ERB <% %>
style delimiters. Alternatively, it also allows the use of [% %]
style tags for delimiters.
Just like Underscore.js, EJS allows arbitrary JavaScript to be parsed when used with the standard <% %>
ERB style syntax, and allows the evaluation of expressions using an equals sign =
following the opening delimiter tag <%= %>:
<ul> <% for (var i = 0; i < people.length; i++) { %> <li><%= firstName %> <%= lastName %></li> <% } %> </ul>
This template can be used to iterate over a list of objects from which key names are evaluated as variables with different values:
{ "people": [ { "firstName": "Peebo", "lastName": "Sanderson" }, { "firstName": "Udis", "lastName": "Petroyka" }, { "firstName": "Jarmond", "lastName": "Dittlemore...