Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
// Helper function to simulate an API call function fetchData(id) { return new Promise(resolve => { setTimeout(() => resolve(`Data for ID ${id}`), 1000); }); } // Sequential execution (~3 seconds total) async function fetchSequential() { console.time('sequential'); const data1 = await fetchData(1); const data2 = await fetchData(2); const data3 = await fetchData(3); console.timeEnd('sequential'); return [data1, data2, data3]; } // Run the sequential example fetchSequential().then(results => { console.log('Sequential results:', results); });
15