You can try following:
In Node.js:
res.render('user', data: res.locals.returnValue);
In EJS:
<script type='text/javascript'>
var rows =<%-JSON.stringify(data)%>
alert(rows);
</script>
Update (as per questions asked in comments):
If you want to loop over the rows
then you should not use JSON.stringify()
since it converts your object into String
and you may try doing the following (following code works if the data put by server is array object).
<script type='text/javascript'>
<% data.forEach(function(dataRow, idxOfRow, orgnlAryObject) {
// You can directly use the dataRow to get each row from the array Object `data`
//alert(JSON.stringify(dataRow)); // <== You can try this
}); %>
</script>