ejs check if variable exists code example
Example: ejs / javascript check if array/object exists and is not empty
<% if(typeof papers == 'object' && papers.length > 0){ %>
// whatever you want to do with 'papers' array
<% } %>
<% if(typeof papers == 'object' && papers.length > 0){ %>
// whatever you want to do with 'papers' array
<% } %>