JSFiddle - React, Tailwind, and code Playground

HTML

<form>
<input type="button" value="Click me!" onclick="window.displaymessage()" />
</form>

<p>By pressing the button above, a function will be called. The function will alert a message.</p>

JavaScript

window.displaymessage= function ()
{    
   var individualScores = [75, 43, 103, 87, 12]
   var teamScore = 0
   for (score in individualScores) {
     if (score > 50) {
        teamScore += 3
    } else {
        teamScore += 1
    }
} 
    
    alert(individualScores)
    alert(teamScore)
}