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

84
Vistas
document.write and loops

Context: I'm learning Javascript and many of the practice codes use document.write(), however I've been reading that it should be avoided, however some things in JS have embedded document.write()

e.g.

var i = 1; 
do {
    document.write ("Cool"); 
    i = i + 500;
} while (i <= 10);

Question: do you attempt to rewrite the loop with an alternative document.write() method (e.g. createELement or innerHTML), or do you simply do your best to avoid its use?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You would want to refactor the write() call to something else like appending to innerText or innerHTML, or (better) creating an element and appending it as a child.

about 4 years ago · Santiago Trujillo 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