Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
I pass a variable to ejs but still throw Uncaught ReferenceError why?

I pass a productId but still get Reference error in ejs why is that happening?

Script in frontend:

<script> 
(typeof <%= productId %> != "undefined" ? productId: -1 )
</script>

Another Try:

if(typeof <%= productId %> != "undefined"){
  const productId = productId
} else{
  const productId = -1
}

Error message:

fall-look:194 Uncaught ReferenceError: look is not defined
    at fall-look:194:14

Catched error with try- catch:

error image

Where error happened:

error console img

We can clearly see a productId is defined but still throw productId is not defined error why is this happened?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!