Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,4 +9,29 @@ license: mit
|
|
| 9 |
short_description: How WouldYouRather.cc Works
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
short_description: How WouldYouRather.cc Works
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# WouldYouRather.cc
|
| 13 |
+
|
| 14 |
+
A fun site to get random "Would You Rather" questions for games and icebreakers.
|
| 15 |
+
|
| 16 |
+
## How it works
|
| 17 |
+
|
| 18 |
+
JavaScript randomly picks a question from an array and displays it.
|
| 19 |
+
|
| 20 |
+
### Demo snippet
|
| 21 |
+
|
| 22 |
+
```html
|
| 23 |
+
<button onclick="showQuestion()">Show Question</button>
|
| 24 |
+
<div id="question"></div>
|
| 25 |
+
|
| 26 |
+
<script>
|
| 27 |
+
const questions = [
|
| 28 |
+
"Would you rather fly or be invisible?",
|
| 29 |
+
"Would you rather have a pet dragon or a pet unicorn?",
|
| 30 |
+
"Would you rather live in the city or the countryside?"
|
| 31 |
+
];
|
| 32 |
+
|
| 33 |
+
function showQuestion() {
|
| 34 |
+
const index = Math.floor(Math.random() * questions.length);
|
| 35 |
+
document.getElementById('question').textContent = questions[index];
|
| 36 |
+
}
|
| 37 |
+
</script>
|