mercredi 3 novembre 2021

How to use math.random to declare a function called randomStopLight?

I am a very new beginner so far, practicing "conditions" now. so here is the exercise where i am stuck now. Wanted to code it badly, though, i don't know how to really start it. Please help me with it. Thank you very much! Below is the text of exercise.

⭐️Declare a function called randomStopLight.

⭐️It should create a random number from 0 to 10. If the number generated is less than 3, the function should return "🔮Red". If the number generated is between 3 and 6 (inclusive of both), it should return "🟡Yellow". If the number generated is greater than 6, it should return "🟱Green".

Aucun commentaire:

Enregistrer un commentaire