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:
https://github.com/mirandaftiago/portfolioproject/blob/master/script.js
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));