OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

writing ejs in a script is giving me the error 'Expression expected'

  • Thread starter Thread starter zak
  • Start date Start date
Z

zak

Guest
I have a script tag in my show.ejs file, and I have the following line:

Code:
<script>
    const post = <%- JSON.stringify(post) %>
</script>

I'm getting the error of 'Error Expected' on both the opening and closing ejs tags. I was wondering why this error occurs and if there was anything I'm doing that isn't allowed.

<p>I have a script tag in my show.ejs file, and I have the following line:</p>
<pre class="lang-js prettyprint-override"><code><script>
const post = <%- JSON.stringify(post) %>
</script>
</code></pre>
<p>I'm getting the error of 'Error Expected' on both the opening and closing ejs tags. I was wondering why this error occurs and if there was anything I'm doing that isn't allowed.</p>
 
Top