ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 88 - Certified JavaScript Developer I discussion

Report
Export

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);});
Answers
A.
Server.catch ((server) => {console.log('ERROR', error);});
B.
Server.error ((server) => {console.log('ERROR', error);});
Answers
B.
Server.error ((server) => {console.log('ERROR', error);});
C.
Server.on ('error', (error) => {console.log('ERROR', error);});
Answers
C.
Server.on ('error', (error) => {console.log('ERROR', error);});
D.
Try{server.start();} catch(error) {console.log('ERROR', error);}
Answers
D.
Try{server.start();} catch(error) {console.log('ERROR', error);}
Suggested answer: C
asked 23/09/2024
Michael Craig
42 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first