Error() vs Error.prototype.message
Error() and Error.prototype.message are both JavaScript Error APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. Error(): Creates a new Error. Its syntax is new Error(message, options). Error.prototype.message: The error message string. Its syntax is error.message. Example of Error(): new Error("Something went wrong"). Example of Error.prototype.message: new Error("fail").message // "fail". Read the full references for Error() and Error.prototype.message to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other Error APIs worth comparing: Error.prototype.name, Error.prototype.stack, TypeError(), RangeError(), ReferenceError(), SyntaxError(). Both belong to the Error category in the JS Reference documentation, which covers 13 entries in total. Try both in the JavaScript playground to see the behavioral difference live.