<html> <head> <script> // Make a POST request to the given URL, // using the given JSON string as the body fetch('http://localhost/seed', { method: 'POST', body: JSON.stringify({seed: Date.now()}) }) .then(res => { const promises = [] // Get 100 random numbers for (let i = 0; i < 100; i++) { promises.push( // Make a GET request to the given URL fetch('http://localhost/next') // Parse the response from JSON .then(res => res.json()) ) } // Wait for all 100 responses return Promise.all(promises) }) .then(numbers => { // Extract the value from each JSON response // and print it to the console for (const number of numbers) console.log(number.value) }) </script> </head> </html>