Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

286
Vistas
Why is it interpreting the code this way?

I've been getting this error: enter image description here

but the line of code it's referring to is for (let i = 0; i < chars.length; i++) {, which is placed within script tags. I don't understand why it isn't recognizing the JavaScript. Also, I'm coding in Notepad (it's saved as an xhtml document), and the browser is Chrome if that is relevant.

I've been having some other problems as well, like not being able to link in CSS, or include elements such as meta in the head section; the webpage comes out blank.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Everything in an XHTML document is parsed as XML, so when it reaches i < chars, the parser thinks the < is going to start a tag, and throws an error when it doesn't. A HTML parser knows to escape the contents between <script> and </script> tags but an XML parser doesn't.

When using XHTML, the < must be escaped within the JavaScript, either as &lt; or by being placed in a CDATA section.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda