Problem Statement
Explain callback in Node.js.
Explanation
A callback is a function passed as an argument to another function, executed once a task completes. It prevents blocking operations and allows asynchronous execution. However, deeply nested callbacks can lead to 'callback hell'.
Code Solution
SolutionRead Only
fs.readFile('file.txt', (err, data) => { if (err) throw err; console.log(data.toString()); });