freeCodeCamp/guide/spanish/javascript/tutorials/create-a-javascript-slot-ma.../index.md

11 lines
434 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Create a JavaScript Slot Machine
localeTitle: Crear una máquina tragamonedas JavaScript
---
Para esto tenemos que generar tres números aleatorios usando la fórmula que nos dan y no la general. `Math.floor(Math.random() * (3 - 1 + 1)) + 1;`
```
slotOne = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotTwo = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
slotThree = Math.floor(Math.random() * (3 - 1 + 1)) + 1;
```