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

233
Views
¿Cómo puedo cambiar el contenido de una etiqueta de párrafo en HTML mediante la declaración if/else de JavaScript?

¿Cómo puedo cambiar el contenido de la etiqueta de párrafo de HTML por JavaScript sin usar document.write? ¿Por qué no aparece cuando lo veo en un navegador? por favor ayúdame a aprender esto. Gracias

 var grades = [45, 32, 66]; var sum = 0; if (grades.length>0){ for (index=0 ; index<grades.length; index++) sum += grades[index]; console.log(sum); document.getElementById('here').innerHTML = sum/grades.length; } else document.getElementById('here').innerHTML = "Empty Array";
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Array average with zero</title> <script src="js/arrays2.js"></script> </head> <body> <p id="here">See Average Here</p> </body> </html>

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!