I have a list that I want to pass from my server side code, app.js into my EJS file. How can I move through the list by having two buttons, a previous and next button. When I press on next, the list index increases by one and the next element on the list is displayed on my screen. Here is my app.js code:
app.get("/home", (req, res)=>{
let letters = ["a", "b", "c", "d"];
res.render("/home", {letters: letters});
})
How can I navigate through the above list in my ejs file by using two buttons, next and previous. Will I have to make a form and route a post request for that as well?
Thanks in advance