0

I have my loop as this in my .ejs file, grades is an array of objects coming from express route

<% for(const grade of grades){ %>
  <%= grade.year %>
<% } %>

Is there any way I could reverse this array, I need the array to be started from the end. Can anyone help me here...

1

1 Answer 1

1
<% for(const grade of grades.reverse()){ %>
    <%= grade.year %>
<% } %>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.