loops in EJS

refer to: https://www.udemy.com/course/the-web-developer-bootcamp/

cats.ejs

<
body> <h1>My baby cats</h1> <%for(let cat of cats){%> <li> <%=cat%> </li> <%}%> </body>
app.get('/cats', (req, res) => {
    const cats = ['sweety', 'candy', 'cutey', 'honey'];
    res.render('cats.ejs', { cats })
})
原文地址:https://www.cnblogs.com/LilyLiya/p/14365339.html