Add the new string to the existing value, followed by the “br” tag to start a new line.
Example:
function rollDice() {
var diceRoll = Math.floor(Math.random() * 6) + 1;
var str="You rolled a " + diceRoll + "!";
document.getElementById("result").innerHTML += str+"<br>"
}
3
solved What is a good way to make a button display text over multiple lines?