【发布时间】:2019-08-26 16:46:26
【问题描述】:
我尝试在 ejs 中比较两个在当前情况下相同的字符串,它运行 else 情况。代码如下:
<% var idf = notifications.data[i].from; %>
<% var ids = notifications.users[a].id; %>
<% if(idf == ids){ %>
<% index = a; %>
<script>alert('<%= index %>');</script>
<% break; %>
<% }else{ %>
<script>console.log('<%= idf %> - <%= ids %>');</script>
<% } %>
它记录 5d5ecfd1ad6d193de86c2264 - 5d5ecfd1ad6d193de86c2264
【问题讨论】:
标签: javascript node.js ejs