Node.js · Middle · Question 7 of 75
Which of these can block the event loop?
- 1
await fetch(url)that takes 3 seconds to answer - 2
await readFile()of a large file - ✓Correct answer:
JSON.parseof a 200 MB string
Explanation
Waiting for the network or disk does not block the loop. Large synchronous operations do: big JSON.parse/stringify, sorting huge arrays, complex regex, sync crypto.