File size: 821 Bytes
2e51ea9
 
 
 
 
 
 
 
 
 
 
2e570f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
title: Wouldyourather
emoji: 📚
colorFrom: indigo
colorTo: gray
sdk: static
pinned: false
license: mit
short_description: How WouldYouRather.cc Works
---

# WouldYouRather.cc

A fun site to get random "Would You Rather" questions for games and icebreakers.

## How it works

JavaScript randomly picks a question from an array and displays it.

### Demo snippet

```html
<button onclick="showQuestion()">Show Question</button>
<div id="question"></div>

<script>
const questions = [
  "Would you rather fly or be invisible?",
  "Would you rather have a pet dragon or a pet unicorn?",
  "Would you rather live in the city or the countryside?"
];

function showQuestion() {
  const index = Math.floor(Math.random() * questions.length);
  document.getElementById('question').textContent = questions[index];
}
</script>