Sync code blocks the main thread until it completes. Async code returns immediately and runs a callback when done, letting the event loop process other work. Always prefer async for I/O operations.
Node.js Interview Questions Every Beginner Should Know
What is the difference between async and sync code in Node.js?
The answer
More FAQs in Node.js Interview Questions Every Beginner Should Know
Node.js is a JavaScript runtime built on Chrome's V8 engine that runs JavaScript on the server. It uses libuv for async I/O and an event loop to process callbacks non-blockingly on a single thread.
A single-threaded loop that processes callbacks from completed async operations. It is what makes Node.js non-blocking and efficient for concurrent I/O, since the main thread is not blocked waiting for operations to complete.
They are Node.js's CommonJS module system. module.exports exports values from a file, and require imports them. This is how Node.js code is split into reusable modules across files.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.