I have set up a loop that is supposed to add 1 to the "generation" to keep track of each iteration of the loop. Generations being the count. But the number is not being appended at all instead the contents of the "counter-display" stay the same. I keep getting the same error "cannot set property 'innerHTML' of null
function evolve() {
let evolutionNumber = 0;
createNextGen();// Apply the rules
updateCurrGen();// Set Current values from new generation
updateWorld();// Update the world view
if (started) {
timer = setTimeout(evolve, evolutionSpeed);
for (i = -1; i < evolutionNumber; i++) {
evolutionNumber++;
document.getElementById("#counter-display").innerHTML = evolutionNumber;
}
}
}
window.onload=()=>{
createWorld();// The visual table
createGenArrays();// Current and next generations
initGenArrays();//Set all array locations to 0=dead
}
<body>
<div id="world">
</div>
<div>
<input type='button' id='btnstartstop' value='Start Reproducing'
onclick='startStopGol();'/>
<input type='button' id='btnreset' value='Reset World'
onclick='resetWorld();'/>
<h1 id="counter-display">(..)</h1>
</div>
<script src="gol.js"></script>
</body>
</html>
sorry if this wasnt enough information just let me know if theres anything more information needed and ill adjust the post accordingly.