I'm experimenting around with the for loop and I think I understand it fairly well.
<button onclick="valpro();">Give us a word</button>
<p id="exper"></p>
<script>
function valpro(){
var askke = prompt("Write something down and we will count all the letters");
var wuku = 0;
var teert = "";
for (; askke.length > wuku; wuku++){
teert += wuku + 1 + ", ";
}
document.getElementById("exper").innerHTML = teert;
}
</script>
Here is what I wrote, and even though its working exactly as I expected it to, I'm still unsatisfied with something. You see the last number given also has a comma at the end and Id prefer it to either have a different thing or just nothing at all. Unfortunately, the guide I'm following says nothing about different code for the last value. Is there a way to give a different block of code to the last value?