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

204
Views
Por qué el contenido se repite 6 veces incluso después de hacer un bucle For 3 veces

Este es el código cuál del nodo JS de una ruta comprueba el resultado

 text.find().then((result)=>{ // let posts = {Uname: result[randomness].username, Tpost: result[randomness].postText, Likes: result[randomness].likes, Postid: result[randomness]._id} let tweets = ''; for(let i = 0; i<3; i++){ randomness = Math.floor(Math.random()*result.length) tweets += ` <div class="tweet"> <div class="pro-pic">A</div> <div class="tweet-content"> <div class="texter"><b>${result[randomness].username}</b></div> <div class="post-content">${result[randomness].postText}</div> <form class="function-buttons" method="post" action="/like/${result[randomness]._id}"> <button class="heart" type="submit"> <div class="ac-animated-heart"> <div class="circle1"></div> <div class="circle2"></div> <div class="square"></div> </div> </button> <input name="postId" type="text" style="display:none" value="${result[randomness]._id}"> <input name="like" value="${result[randomness].likes}" readonly class="likes"> </form> </div> </div> `; } // console.log(tweets) let posts = {content: tweets} res.status(200).render('index.pug',posts) })
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!