Skip to content

Instantly share code, notes, and snippets.

@utsukushiihime
Created September 9, 2020 17:09
Show Gist options
  • Save utsukushiihime/3dc637812b8751c65dd5ad61b30a4e68 to your computer and use it in GitHub Desktop.
Save utsukushiihime/3dc637812b8751c65dd5ad61b30a4e68 to your computer and use it in GitHub Desktop.
EJS forEach
<body>
<h1>Here are all the fruits!</h1>
<a href="/fruits/new">add fruit (+)</a>
<% fruits.forEach((fruit, index) => { %>
<li>
<a href="/fruits/<%= index %>"> <%= fruit.name %> </a>
</li>
<% }); %>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment