Node.js · Senior · Question 54 of 75
What does the using declaration (explicit resource management) give Node.js code?
{
await using conn = await pool.connect();
await conn.query("...");
} // conn is disposed here- ✓Correct answer: Automatic cleanup via
Symbol.dispose/Symbol.asyncDisposewhen the block exits, even on errors - 2A faster way to import modules
- 3Shared variables between workers
Explanation
It replaces many try/finally blocks. Some Node.js APIs, like timers and file handles, already implement the dispose symbols.