Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda