How to spam numbers in javascript

I want from script to do
1
2
3
4
5…
But it give me 499.
What I need to add to the script is not to add numbers but just to print them

function numbers() {
  for (let i = 0; i < 500; i++) {
    var spam = i + "<br>";
  }
  document.getElementById('demo20').innerHTML = spam;
}