Getting String array from node js to ejs Getting String array from node js to ejs mongoose mongoose

Getting String array from node js to ejs


I found where I was going wrong.

In index.ejs, instead of this...

labels: [<%= value %>],

It should be...

labels: <%- JSON.stringify(country)%>,

Basically the array I was receiving from app.js was kind of [abc,xyz,pqr].So to convert it to a string array like ['abc','xyz','pqr'], we have to use JSON.stringify()

Anyways, thanks folks!