I am making a Ludo game and my condition is if there are three 6 in a row then the user's chance will be passed to the next user. I made a random number from 1 to 6. I was storing the last digit with a variable called lastDice and compared the last one with a recent random number but I can not get the idea of the last 3 random numbers to compare. **But the condition is if the last 3 random numbers are 6s(6,6,6) then the game must stop**. Codes are as follows:

```js
const playing = true;
const random = Math.floor(Math.random() * 6 + 1);
const lastDice = 0;

if (playing) {
  if (random === 6 && lastDice === 6) {
    document.getElementById('score--1').textContent = 0; // update the ui
  } else {
    nextPlayer(); // its a function to call the next player
  }

  lastDice = dice; // storing the last random number for comparing next random number
}
```