Full Stack Path - Mixed Messages Horoscope-esque

Hello!

I made a horoscope-esque message generator for the mixed messages project.

I was a little intimidated by this one after seeing it mentioned frequently in the discord but was surprised to find that it only took me about 3 hours to complete and I got way more comfortable with git terminal commands and github itself.

I would rate this project pretty highly as it required independent planning and execution. I finally wrapped my head around document.write and getElementById by forcing myself to tie the generated message to the click of a button. Which then prompted me to learn how to style the text generated using document.write.

Anyway, its not too pretty but it does the job! Any feedback welcome. :slight_smile: Link below.

congrats, on finishing and for taking it further with putting it in browser!

I had a look at your code, and you did a great job, I would suggest one change. Your randomiser function is repeated four times. You could do this once and add a parameter to change for what message it would randomise for

See below how I’d re-write it in the following way

function rWord(words) {
    let randIndex = Math.floor(Math.random() * words.length);
    return words[randIndex];
}

then you can just call your function along with the array you want to randomise

console.log(rWord(feeling))

something like that.

Hey, thank you so much for the response!!

That code is much more efficient and it gave me the chance to figure out how to branch my repository, commit/push changes, make a pull request and finally merge my branches.

I’m still shaky on git/GitHub so that was very valuable practice for me.

Thanks again, have a great day!

1 Like

That’s such a great idea, Devon! I’m going to try to implement that in my own random wanted ads generator.