Here is a full example that just focuses on how to call a random function from an array of functions and execute it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pick a Random Function</title>
</head>
<body>
<script>
function hello(name) {
console.log(`Hello, ${name}!`);
}
function goodBye(name) {
console.log(`Good Bye, ${name}!`);
}
function helloAndGoodBye(name) {
console.log(`Hello and Good Bye, ${name}!`);
}
function whatsUp(name) {
console.log(`What's up?, ${name}!!!`);
}
let allFunctions = [hello, goodBye, helloAndGoodBye, whatsUp];
let randomNumber = Math.floor(Math.random() * allFunctions.length);
// call the random function and pass in our argument
allFunctions[randomNumber]("Pixel");
</script>
</body>
</html>