Node.js | Assert module
Assert module in Node.js provides a bunch of facilities that are useful for the assertion of the function. The assert module provides a set of assertion functions for verifying invariants. If the condition is true it will output nothing else an assertion error is given by the console.
Install the assert module using the following command:
npm install assert
Note: Installation is an optional step as it is inbuilt Node.js module.
const assert = require("assert");
Note: In this example, no try-catch is given so an assertion error of the kind given below will be the output.
Note: Text Highlighted is the assertion error.