MCPcopy
hub / github.com/bradtraversy/vanillawebprojects / getRandomUser

Function getRandomUser

dom-array-methods/script.js:15–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14// Fetch random user and add money
15async 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
30function doubleMoney() {

Callers 1

script.jsFile · 0.85

Calls 1

addDataFunction · 0.85

Tested by

no test coverage detected