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

112
Views
javascript para error de bucle error de tipo no detectado en .length

Actualmente estoy haciendo una tarea escolar. El objetivo es hacer una aplicación simple de publicación de redes sociales usando Django y JavaScript. JavaScript se utiliza para cargar dinámicamente publicaciones en la página web y reemplazar partes HTML. Estaba siguiendo una lección de YouTube https://youtu.be/f1R_bykXHGE para ayudarme. A pesar de que he seguido el tutorial uno por uno, recibo el siguiente error de tipo no detectado: no se pueden leer las propiedades de undefined (leyendo 'longitud') en XMLHttpRequest.xhr.onload ((índice): 63:28).

 const postsElement = document.getElementById("posts") // get an html element // postsElement.innerHTML = 'Loading...' // set new html in that element // var el1 = "<h1>Hi there 1</h1>" // var el2 = "<h1>Hi there 2</h1>" // var el3 = "<h1>Hi there 3</h1>" // postsElement.innerHTML = el1 + el2 + el3 const xhr = new XMLHttpRequest() const method = 'GET' // "POST" const url = "/posts" const responseType = "json" xhr.responseType = responseType xhr.open(method, url) xhr.onload = function() { const serverResponse = xhr.response const listedItems = serverResponse.response // array var finalPostStr = "" var i; for (i=0;i<listedItems.length;i++) { console.log(i) console.log(listedItems[i]) } } xhr.send() </script>

Aquí hay una instantánea del tutorial de Youtube.

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!