• Olivia
  • Emma
  • Charlotte
  • Amelia
  • Ava
  • Sophia
  • Isabella
  • Mia
  • Evelyn
  • Harper

HTML

Names taken off The Bump.

<ul>
 	<li class="listed-names">Olivia</li>
 	<li class="listed-names">Emma</li>
 	<li class="listed-names">Charlotte</li>
 	<li class="listed-names">Amelia</li>
 	<li class="listed-names">Ava</li>
 	<li class="listed-names">Sophia</li>
 	<li class="listed-names">Isabella</li>
 	<li class="listed-names">Mia</li>
 	<li class="listed-names">Evelyn</li>
 	<li class="listed-names">Harper</li>
</ul>

JavaScript

function pickWinner( num ) {

    let win = Math.floor( Math.random() * num );
    let dinner = document.getElementsByClassName( "chicken-dinner" );
    dinner[0].innerText = listedNames[ win ].innerText;
}

let listedNames = document.getElementsByClassName( "listed-names" );

pickWinner( listedNames.length );

Result

The winner is:

Back To TIL