![]() |
VOOZH | about |
The console.error() function from the console class of Node.js is used to display an error message on the console. It prints to stderr with a newline.
Syntax:
console.error([data][, ...args])
Parameter: This function can contain multiple parameters. The first parameter is used for the primary message and other parameters are used for substitution values.
Return Value: The function returns an error message.
The below programs demonstrate the working of the console.error() function:
Program 1:
Output:
Enter number greater than 100
Program 2:
Output:
20 is less than or equal to 50