Good Times Mixed Message Generator

Review of the project:
not so hard to implement, for me it’s harder to plan than to execute the task.

Took about an hour or so.
Besides it all i enjoyed the exercise, and here it is my repo URL:

My approach to message generator:

const firstArr = [“SpiderMan”, “Homer”, “C3PO”, “Gandalf”, “Princess Leia”];
const secondArr = [“drinks”, “waltzing with”, “enjoying a”];
const thirdArr = [“vodka by the sea”, “beer at Millenium Falcon”, “whisky at the bar”, “Port wine on the Titanic”, “gin”];

function getRandomIndex(array) {
return Math.floor(Math.random() * array.length);


function getMessage(array) {
return array[getRandomIndex(array)];

function getFullMessage(firstArr, secondArr, thirdArr) {
return getMessage(firstArr) + " " + getMessage(secondArr) + " " + getMessage(thirdArr);

console.log(getFullMessage(firstArr, secondArr, thirdArr));

1 Like

Hi! Everything looks good from a functionality perspective.

However, as a reviewer, it would have been easier to read and understand what the code does if you had named your variables to be more representative of what they contain.


  • firstArr could have been named characters,
  • secondArr could be named verbs or activities

Hi Becca, thanks for the reply. I’m really new to this environment, but i took note of the suggestion. Thanks again.

1 Like

No problem! Naming things are one of the problems facing coders that just never stops being relevant - just keep practicing! :man_technologist: