Skip to content

Instantly share code, notes, and snippets.

@H-Bo214
Created March 30, 2020 17:29
Show Gist options
  • Save H-Bo214/f6f416f5b9588898950251cf30905f96 to your computer and use it in GitHub Desktop.
Save H-Bo214/f6f416f5b9588898950251cf30905f96 to your computer and use it in GitHub Desktop.
Magic 8 ball pseudo code

Create html & CSS for Magic 8 ball.

Create a query Selector for the magic 8 ball display.

Create an event listener on the parent element of the 8 ball that triggers the event on a click.

Create an eventHandler function to invoke the function in your listener upon the click.

Create an array of magic 8 ball responses.

Create a function that is linked to your event listener to execute upon the click.

In this function create a statement that will randomly cycle through your response array and return the randomly selected element.

Create another function that displays the random response through the DOM to your 8 ball display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment