Mixed Messages Zodiac Generator

The project difficulty was just right, it took me about 1-2 hours to complete. Here is a link to my repo: GitHub - kierath/Mixed-Messages: Portfolio Project. I look forward to hearing any feedback! Thanks!

Your code has a lot of instances of [Math.floor(Math.random() * arrayName.length)];

Generally, when you see repetition like that you can refactor it to use a function.

For example,

function getRandom(arg) {
    return arg[Math.floor(Math.random()*arg.length)];

and then pass your arrays into the function as an argument instead of making an individual variable that applies the randomization to each individual array.

1 Like