- Declare a variable for an array that holds the possible magic 8 ball responses
- Create a function called getRandomIndex that takes in one parameter (the array) and returns a random number relative to the length of the array
- Create a second function called getFortune that applies the random index from the funtion getRandomIndex but outputs the corresponding value instead of just a number
- Create an input box that allows users to ask their question
- Create a submit button for the user to click after they've typed their question
- Once the submit button is clicked, the getFortune function should run a random magic 8 ball response should show up
- The user should be able to ask the same question multiple times
Created
March 30, 2020 17:22
-
-
Save asodemann18/3da6dbfb169df15d34bdcaf13e7dd282 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment