CSD 360 - JS Switch Statement Dice Roll

Mod 5 Assignment

This assignment utilizes a form that includes two dice and a button to roll them. When the roll dice button is clicked, the JavaScript code generates two random numbers (1-6) and adds them together for the total. A swith statement is utilized to output specific text based on the total value of the dice roll and to transorm the dice to a specific face based on the roll values.


Results such as:

  1. "Snake Eyes" = Total of 2
  2. "You Win!" = Total of 7 or 11
  3. "Box Cars" = Total of 12
  4. "(total)" = Default case to output total

Dice Roll Simulation
Dice 1 Dice 2
Total