0Pricing
Javascript for Kids · Lesson

Two Dice

Add the rolls.

Double the Fun! 🎲🎲

One die is fun, but two dice are even better! 🎲🎲

Many games roll two dice and add them together. Let's do that! ➕

console.log('Rolling two dice! 🎲🎲')
console.log('Then we add them up! ➕')

Roll the First Die 🎲

First, roll one die and save it in a box called die1. 📦

Same as before: random times 6, plus 1! 🎲

let die1 = Math.floor(Math.random() * 6) + 1
console.log('Die 1: ' + die1 + ' 🎲')

All lessons in this course

  1. Rolling a Die
  2. Two Dice
  3. Tracking Dice Points
  4. First to Twenty
← Back to Javascript for Kids