Files
freeCodeCamp/guide/russian/javascript/tutorials/create-a-javascript-slot-machine/index.md
2018-10-16 21:32:40 +05:30

11 lines
532 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Create a JavaScript Slot Machine
localeTitle: Создать игровой автомат JavaScript
---
Для этого мы должны сгенерировать три случайных числа, используя формулу, которую они дают, а не общую. `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;
```