Here is my javascript loop
for (var i=1; i <= 100; i++)
{
if (i % 15 == 0)
console.log("DuckGoose");
else if (i % 3 == 0)
console.log("Duck");
else if (i % 5 == 0)
console.log("Goose");
else
console.log(i);
}
Im just recently getting into learning html , and java script in my attempts to become a full stack developer by the end of the summer.. Here im trying to use an html button to start/stop this loop and use the function listed below the number 3. Below is what I have so far on the HTML side. Im really hung up and stuck on how to start/stop this loop using this button. Can someone teach me the best way to do this in a beginner way? Still learning. Thanks
<body>
<div>
<button>Click me</button>
</div>
</body>
3
function write (o) {
var el = document.createElement('pre');
el.innerHTML = JSON.stringify(o, undefined, 2);
document.body.appendChild(el);
}