<body>
<h1>Home Page</h1>
<ul>
<li>Name: <%= restaurant.name %></li>
<li>Address: <%= restaurant.address %></li>
<li>Phone: <%= restaurant.phone %></li>
<li>
<%= restaurant.isOpen === true ? "Yes, we are open!" : "No, we are
closed" %>
</li>
</ul>
</body>
Using Node.js, on localhost:3000,
The above code does not work and gives the following error:
SyntaxError: Invalid or unexpected token in /Users/armadillon/code/ga/labs/ejs-lab/views/home.ejs while compiling ejs
If I remove the exclamation point, the code works fine (ternary works as expected)
I can move on with my project, but this is REALLY bugging me. Why does the exclamation point break it?! An itch I can’t scratch.
I have tried replacing the exclamation point with
!
!
021
And all of those with or without quotation marks, backticks, etc.
I expect the outpout to be “Yes, we are open!”
padcoding is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.