@Kehinde13Submitted over 2 years ago
zqwirp
@zqwirpAll comments
- @zqwirpPosted over 2 years ago
You can use random numbers to generate random suggestions, for example:
const slipId = Math.floor(Math.random() * (224 - 1)) + 1; const data = await fetch("https://api.adviceslip.com/advice/" + slipId) .then(res => res.json()) .then(res => { return { id: res.slip.id, advice: res.slip.advice, }; });
1