I am working in full stack project , I use express to build sever and EJS for rendering pages the line bellow is for render profile file and pass data to EJS file
res.render("profile", { user });
my question is how to pass data from this EJS file to I tried this way :
<% let userPostsData = user.posts %>
<script>
let userPostsData = "<%= userPostsData %>";
</script>
but I have this error :
Uncaught SyntaxError: Invalid or unexpected token