Variable undefined problem in ejs

  node.js, question

I am working on a nodejs web application, using the template engine of ejs. Now I want to get a chart, using Baidu’s echarts. At first, I can get the data out and put it into echarts to generate a chart. However, once the service is restarted, there will be a bug. Paste the code I wrote. After the service is restarted, the error is my incomes variable undefined. However, it was written at the beginning that there was no problem. After restarting the service, I asked you what the problem was.

<script type="text/javascript">
 < percentage if(user){ percentage >
 var date=[];
 var legend=[];
 var pureDate=[];
 var legendDate=[];
 < percentage incomes.foreach (function, index) {percentage >
 Legend.push ("< percentage = income.incomeSubject percentage >");
 Push (< percentage = income.incomeddate percentage > ")
 Date.push({value: "< percentage = income.incomeAmount percentage >", name: "< percentage = income.incomeSubject percentage >"});
 PureDate.push (< Percent = income.incomeAmount Percent > ");
 var myChart = echarts.init(document.getElementById('incomeChart'));

Just look at the front-end code can’t see, the back-end nodejs processing function posted to see? It is better to post the wrong output as well.