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

163
Views
How can I rewrite innerHTML everytime function is called javascript
function he() {
  var x = Math.floor((Math.random() * 100) + 1);
  document.getElementById("res1").innerHTML = "Heroes have dealt " + x + " damage on villains.";
  var vhp = villains - x;
  document.getElementById("res2").innerHTML = "<br/>Villains have " + vhp + "  hp left.";
  vok();
}

function vok() {
  var y = Math.floor((Math.random() * 100) + 1);
  document.getElementById("res3").innerHTML = "<br/>Villains have dealt " + y + " damage on Heroes.";
  var hhp = hero - y;
  document.getElementById("res4").innerHTML = "<br/>Heroes have " + hhp + "  hp left.";
  he();
}

Here is the above code I made function he() is called when a button is clicked and vok function is called after execution of he() function but it's not going good currently i want to overwrite the innerHTML every time the function is runned how am I supposed to do so?

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!