简体   繁体   中英

Unexpected identifier in /location while compiling ejs

I keep getting these "Unexpected identifier in /location/ while compiling ejs" Not sure what the solution is here, I've tried to use the different opening tags but when I use the "<%-" tag I get an unidentified if statement error message

<% if (kindOfDay === "Saturday || kindOfDay === "Sunday") { %>
  <h1 style="color: blue"> <%=kindOfDay%> To Do List</h1>
<% } else { %>
  <h1 style="color: green"> <%=kindOfDay%> To Do List</h1>
<% } %>

You have missed the closing quotation mark for the first condition. Try this one,

<% if (kindOfDay === "Saturday" || kindOfDay === "Sunday") { %>
  <h1 style="color: blue"> <%=kindOfDay%> To Do List</h1>
<% } else { %>
  <h1 style="color: green"> <%=kindOfDay%> To Do List</h1>
<% } %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM