I know only very little about JavaScript so far but I wanted to implement a small script which I thought to sound quite simple. I have a line in a HTML document saying (translated) "Has written X posts" and basically I would like it to just say "post" at the end when that number is 1.
Here's what I got so far. My editor is already showing me that something is wrong with the script, though on my own I haven't really been able to figure out what. Little help would be appreciated :')
<html>
Hat insgesamt <span id="zahl">29</span> <span id="spuren">Spuren</span> hinterlassen.
</html>
<script>
let spur;
if (document.getElementById("zahl").innerHTML) = 1 {
spur = "Spur";
} else {
spur = "Spuren";
}
document.getElementById("spuren").innerHTML = spur;
</script>