JS Error Object
Error objects carry a name, message, and often a stack trace. Keep internal debugging details separate from public messages.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const error = new TypeError("Quantity must be a number.");
console.log(error.name);
console.log(error.message);
What happens
The type and message describe the failure.