// Create an array of potential team names
const teamNames = [“Red Dragons”, “Blue Sharks”, “Green Lions”, “Yellow Suns”, “Purple Phoenix”];

// Create a function that generates a random number within a given range
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max – min + 1) + min);
}

// Create a function that returns a random team name
function getRandomTeamName() {
// Generate a random index number based on the length of the teamNames array
const index = getRandomNumber(0, teamNames.length – 1);

// Return the team name at the randomly generated index
return teamNames[index];
}

// Create a button element
const button = document.createElement(“button”);

// Set the button text to “Generate Team Name”
button.innerText = “Generate Team Name”;

// Add an event listener that calls the getRandomTeamName function
// and alerts the result when the button is clicked
button.addEventListener(“click”, () => {
alert(getRandomTeamName());
});

// Append the button to the document body
document.body.appendChild(button);