Mixed Messages, bad joke generator

//TODO #1: create 4 arrays containing chunks of messages

const start = [“a man walks into a bar”, “knock knock”, “did you hear the one about the”, “what do you call a”];

const startMid = [“bartender says to the man”, “who is there?”, “nun with the pet lizard?”, “a dog in a car in a catapult”];

const endMid = [“why the long face?”, “The FBI”, “I hear they call her the”, “they call it a”];

const end = [“I am feeling hoarse.”, “click-clack you’ll never take me alive!”, “lady that has a lizard.”, “case of animal abuse”];

//TODO #2: create a function to choose a random index

function getRandomIndex(arrayIn){

return Math.floor(Math.random()*arrayIn.length);

}

//TODO #3: create a function to return a random message chunk from an array

function getMessageChunk(arrayIn){

return arrayIn[getRandomIndex(arrayIn)];

}

//TODO #4: create a function to put together four message pieces

function getFullMessage(array1, array2, array3, array4){

return getMessageChunk(array1) + " " + getMessageChunk(array2) + " " + getMessageChunk(array3) +" " + getMessageChunk(array4);

}

//TODO #5: log resulting message to the console

console.log(getFullMessage(start, startMid, endMid, end));