Picking a Random Item from an Array

Oh wow! you’re amazing man!
Thank you so much for this.

I can add more function groups to it freely right?

edit:
while testing it did not work…
this is my current code:

const Discord = require("discord.js");

const client = new Discord.Client();

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

client.on('ready', async () => {

var server = client.guilds.get("716227489860681738");
var channel = server.channels.get("716227489860681743")

console.log(`Logged in as ${client.user.username}, ready to get this bread.`);
for (var i = 0; i < 1000000; i++) {
    function groupOne() {
    channel.send('1')
    await sleep(10000)
    channel.send('2');
    await sleep(10000)
  }
  
  function groupTwo() {
    channel.send('3')
    await sleep(10000)
    channel.send('4');
    await sleep(10000)
  }
  
  let groups = ["one", "two"];
  let group = groups[Math.floor(Math.random() * groups.length)];
  
  if (group == "one") {
    groupOne();
  } else {
    groupTwo();
  }
}


    });


client.login(process.env.token)

Do you see an error i am not?
its giving me 0 errors…