Exam4Training

Given the code and the information the developer has, which code logs an error at boost with an event?

developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality.

The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.

Given the code and the information the developer has, which code logs an error at boost with an event?
A . Server.catch ((server) => {
console.log(‘ERROR’, error);
});
B . Server.error ((server) => {
console.log(‘ERROR’, error);
});
C . Server.on (‘error’, (error) => {
console.log(‘ERROR’, error);
});

D . Try{
server.start(); } catch(error) { console.log(‘ERROR’, error);
}

Answer: C

Exit mobile version