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

90
Views
¿Por qué hay un espacio no deseado en esta función de máquina de escribir?

Sin embargo, esto genera L oading cuando ejecuto esto, no hay errores de compilación en absoluto, estoy tan confundido, sé cómo resolver esto (solo pon un espacio antes) pero quiero saber por qué sucede

 <!DOCTYPE html> <html> <body> <script> var i = 0; var txt = 'Loading'; function type() { if (i < txt.length) { document.body.innerHTML += txt.charAt(i); i++; setTimeout(type, 50); } } type(); </script> </body> </html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está modificando el elemento del cuerpo antes de que termine de renderizarse. Si espera para comenzar a escribir hasta después de que la página haya tenido la oportunidad de cargarse por completo (llamando a su primer tipo en onload), funcionará como se esperaba.

 <!DOCTYPE html> <html> <body> <script> var i = 0; var txt = 'Loading'; function type() { if (i < txt.length) { document.body.innerHTML += txt.charAt(i); i++; setTimeout(type, 50); } } window.onload = function() { type(); } </script> </body> </html>

about 4 years ago · Juan Pablo Isaza Report
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!