Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The purpose of the line that reads throw new Error is to throw an exception with the message "Invalid argument" when the value of n is less than or equal to 0. This is an error that should be caught and handled by the caller of the function.