Assert method

Report a typo

You are working on a function that checks users' ages. The age parameter should be greater than 14, use the assert method to throw an error if the age is less than 14. Also, provide a customized error message of your preference.

The assert module is already imported, so you won't have to include it in your code.

const assert = require('node:assert');
Enter a short text
___

Create a free account to access the full topic