Mixed Messages: Dungeons & Dragons mission generator

Hi Everyone!

I just finished the mixed messages project. My daughter is really into D&D , so I decided to create my program to randomly generate a race, class, mission location and “campaign” name every time it is run. I have not done any html or css to accompany it yet, but will probably circle back to it in a bit.

Here is my code:

// Defined arrays to generate from
const heroRace = ["Human", "Elf", "Dwarf", "Grung", "Owlin", "Thri-kreen", "Dragonborn", "Plasmoid", "Autognome"];
const heroClass = ["Barbarian", "Paladin", "Rogue", "Ranger", "Druid", "Monk", "Bard", "Cleric", "Warlock"];
const missionSetting = ["Forgotten Realms", "Spelljammer", "Eberron", "Exandria", "Greyhawk", "Ravenloft", "Dragonlands", "Strixhaven", "Blackmoor"];
const missionGoal = ["Mummified Goblin Hand", "Lost Legionaire Insignia", "Enchanted Five-pointed Star", "Set of Bone Pipes", "Magical Silver Bell", "Vial of Dragon Blood", "Ancient Elven Arrow", "Dragon Talon Necklace", "Brass Rune Orb"];

// Function to generate random selection from the arrays
function getRandomElement(array) {
  const randomIndex = Math.floor(Math.random() * array.length);
  return array[randomIndex];
}

// Function to generate random mission
function generateRandomMission() {
  const selectedHeroRace = getRandomElement(heroRace);
  const selectedHeroClass = getRandomElement(heroClass);
  const selectedMissionSetting = getRandomElement(missionSetting);
  const selectedMissionGoal = getRandomElement(missionGoal);

  // Display the results to the user
  console.log("Hero Race: " + selectedHeroRace);
  console.log("Hero Class: " + selectedHeroClass);
  console.log("Mission Setting: " + selectedMissionSetting);
  console.log("Mission Goal: " + selectedMissionGoal);
}

// Generate a random mission
generateRandomMission();

Also the link to my repository: