Node.js - Error Handling Patterns
Consider the following code snippet:
What will be printed to the console?
function readFile(callback) {
setTimeout(() => {
callback(null, 'file content');
}, 100);
}
readFile((err, data) => {
if (err) {
console.log('Error:', err);
} else {
console.log('Data:', data);
}
});What will be printed to the console?
