I’m having a tough time doing this.
And what I mean is, pull a prompt box, and if you input either “Test1″ Test2” “Test 3”, then there’s a random chance that when you click okay, an alert box says either test1, test2, test3 randomly.
You could switch the text to be outputted using a `switch` statement with a random number generation as the condition to switch:
var numRand = Math.floor(Math.random()*2) // generate number between 1 and 3
// code for 1st scenario
// code for 2nd scenario
// code for 3rd scenario
// what to do if, for some reason, an invalid number was parsed
You random number calculation is wrong.
// This will never give you 2. Only 0, 1
// This will give you 0-2 outcomes
You must be logged in to reply to this topic.