Can someone help me to get sum of pushed numbers to array ? I need to get sum displayed after 20th Rounds. I push scorePoint which is typed by player and all the score need to be multiplied after 20 round to see result.
var round = 1;
var score1 = [];
function roundNr() {
round++;
document.getElementById("p").innerHTML = round;
}
function scoreCntr() {
var scorePoint1 = document.getElementById('score1').value;
score1.push(scorePoint1);
if (round > 20) {
document.getElementById("score").innerHTML = score1;
}
}
<div class="input_box">
<input type="name" placeholder="Name" id="name1">
<input type="text" placeholder="Score" id="score1">
<button onclick="roundNr(); scoreCntr();">Submit</button>
</div>
<div class="round_box">
<h1>ROUND</h1>
<p id="p">1</p>
</div>
<div id="score">
</div>