In my score tracking app I'm trying to display the name (#firstPlacePlayer) and score (#firstPlaceScore) with the current leader as game goes on. I want to move only high scorer values of the h3 to my h2. My HTML:
<h2><span id="firstPlacePlayer">Leader </span>has
<span id="firstPlaceScore">0</span> points!</h2>
<h3><span class="p1Name">Ben</span>: <span id="p1Display">2</span> VPs</h3>
<h3><span class="p2Name">Dan</span>: <span id="p2Display">2</span> VPs</h3>
My javascript:
var p1Name = document.querySelector('p1Name');
var playerScores = [p1Score, p2Score]
var firstPlace = Math.max.apply(null, playerScores);
function changeLeader () {
document.getElementById('firstPlaceScore').textContent = firstPlace;
};