Mixed Messages - 'onclick'

Hello everybody,

Thank you for sharing your projects and your experiences.

I’ve just finished the project. TBH When I started to put things together I didn’t know which way to get to the final result, so I built it following a simple array, Math.random, and function structure.

That’s the link if you’d like to take a look :smiley:

Cheers!!

Nicely done!!

One thing I recommend is with your three random constants:

  • firstRandom
  • secondRandom
  • thirdRandom

Since they are assigned in the global scope when the page loads as constants, they stay the same until you reload the page, no matter how many times you push the button. If you declare them inside your function generateRandomName() than they will be reassigned every time the function is called, and the message will change every time the button is pressed.

Thanks for your feed @8-bit-gaming!

Works like magic :smiley:

1 Like