Skip to content

Instantly share code, notes, and snippets.

@zolotyh
Last active July 25, 2023 09:45
Show Gist options
  • Save zolotyh/74048f250bfe486ca3312ce63643ae62 to your computer and use it in GitHub Desktop.
Save zolotyh/74048f250bfe486ca3312ce63643ae62 to your computer and use it in GitHub Desktop.
import fs from 'fs';
const stream = fs.createReadStream('./sample.txt');
stream.on('data', () => console.log(1));
setTimeout(() => console.log(2));
for (let i = 0; i < 1000000; i++) { // 10s
/*code*/
}
console.log(3);
// What order of messages are expected to be printed to the console? Why?
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment