<input type="text" placeholder="Skriv in ett tal (2-9)">
<button type="button" onclick="burrTal()">Burrtal</button>
<div></div>

<script>
const burrTal = () =>{
const input = document.querySelector("input").value;
const output = document.querySelector("div");
output.innerHTML = "";

if (input < 2 || input > 9) output.innerHTML += "Måste vara tal mellan 2 - 9";
let i = 1;

while (i < 100){
if (input < 2 || input > 9) break;
const burrTal = (i % input == 0) ? output.innerHTML += "burr, " : output.innerHTML += i + ", ";
i++;
}
}
</script>