()
| 13 | |
| 14 | // Fetch random user and add money |
| 15 | async function getRandomUser() { |
| 16 | const res = await fetch('https://randomuser.me/api'); |
| 17 | const data = await res.json(); |
| 18 | |
| 19 | const user = data.results[0]; |
| 20 | |
| 21 | const newUser = { |
| 22 | name: `${user.name.first} ${user.name.last}`, |
| 23 | money: Math.floor(Math.random() * 1000000) |
| 24 | }; |
| 25 | |
| 26 | addData(newUser); |
| 27 | } |
| 28 | |
| 29 | // Double eveyones money |
| 30 | function doubleMoney() { |