Is my index.ejs template forEach supposed to drop a closing paren?
13:15 28 Nov 2025

Given:

    
    <%= users.forEach(function(user){ %>
  • <%= user.name %>
  • <%= }); %>

and:

app.set('view engine', 'ejs');

app.get('/', (req, res) => {
    res.render('index', { 
        title: 'Foobar',
        message: queryDatabase(),
    users: [{ name: 'Foo' }, { name: 'Bar' }]
    });
});

I am receiving: SyntaxError: Unexpected token ')' in C:\((path))\node\views\index.ejs while compiling ejs

I'm not actually clear on why I'm getting this syntax error. I've used the ctrl+f function in my IDE to find all of the ) and verified that all closing parens have a corresponding opening paren.

html node.js ejs