October 22, 2024
Chicago 12, Melborne City, USA
HTML

Why is the JavaScript Variable not showing on the page?


I have a peice of code trying to make a list of 25 average numbers 1-25 and they are not showing on the page.

window.onload = function() {
  const alt = [];
  const avgRate = 3; 
  for (let i = 0; i = 25; i++) {
    alt.push(Math.random()*25)
  }
  console.log(alt); 
  document.getElementById('output').innerHTML = alt;
}
<p id="output"></p>

I expected the lists to appear on the page but did not see them Can someone help me with this?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video