Error in EJS file with if statement in script tage

Viewed 47

I am getting this error in ejs when I am putting if statement in script tag

Error

summary:118 Uncaught (in promise) TypeError: "" is not a function

and my code is

 let chartArray=[];
 chartArray.push(['Province', 'Cases']);
 `<%for (let p in provinces){%>`
        `<% if(p==province){ %>`
              chartArray.push([`<%=p%>`,dataarray]);
        `<% } %>`
 `<%}%>`
 let data = google.visualization.arrayToDataTable(chartArray);

Its works without if statement but I want the conditions

0 Answers
Related