<input id="tal1" type="text" placeholder="Tal 1">
<input id="tal2" type="text" placeholder="Tal 2">
<input id="tal3" type="text" placeholder="Tal 3">
<button type="button" onclick="compare()">Jämför</button>
<div></div>

<script>
const compare = () =>{
const tal1 = parseInt(document.getElementById("tal1").value);
const tal2 = parseInt(document.getElementById("tal2").value);
const tal3 = parseInt(document.getElementById("tal3").value);

let divValue = document.querySelector("div");

let nummer = [tal1, tal2, tal3];

let störstaTal = 0

for (i = 0; i < nummer.length; i++){
if (nummer[i] > störstaTal){
störstaTal = nummer[i];
}
}
divValue.innerHTML = "Det största talet var: " + störstaTal;
}
</script>