I am doing a blog and I would like the blog entries to be shown from the newest to the oldest, I was wondering if there is any way to go back and forth with a foreach.
The code I have now is this:
<% blogs.forEach(function(blog){ %>
<img src="<%= blog.image %>" style="height: 200px">
<p><h4><%= blog.title %></h4><span><%= blog.category %></span></p>
<p><%= blog.content %></p>
<p><%= moment(blog.createdAt).fromNow() %></p>