--- title: SyntaxError.prototype slug: conflicting/Web/JavaScript/Reference/Global_Objects/SyntaxError tags: - Error - JavaScript - Propriété - Prototype - Reference - SyntaxError translation_of: Web/JavaScript/Reference/Global_Objects/SyntaxError translation_of_original: Web/JavaScript/Reference/Global_Objects/SyntaxError/prototype original_slug: Web/JavaScript/Reference/Objets_globaux/SyntaxError/prototype ---
{{JSRef}}

La propriété SyntaxError.prototype représente le prototype du constructeur {{jsxref("SyntaxError")}}.

Description

Toutes les instances de {{jsxref("SyntaxError")}} héritent de SyntaxError.prototype. Le prototype peut être utilisé afin d'ajouter des propriétés ou des méthodes à toutes les instances.

Propriétés

SyntaxError.prototype.constructor
Définit la fonction qui a créé le prototype d'une instance.
{{jsxref("Error.prototype.message", "SyntaxError.prototype.message")}}
Un message d'erreur. Bien que ECMA-262 définisse que {{jsxref("SyntaxError")}} doit avoir une propriété message en propre, dans SpiderMonkey, elle est héritée depuis {{jsxref("Error.prototype.message")}}.
{{jsxref("Error.prototype.name", "SyntaxError.prototype.name")}}
Un nom d'erreur. Propriété héritée depuis {{jsxref("Error")}}.
{{jsxref("Error.prototype.fileName", "SyntaxError.prototype.fileName")}}
Le chemin du fichier qui a causé l'erreur. Propriété héritée depuis {{jsxref("Error")}}.
{{jsxref("Error.prototype.lineNumber", "SyntaxError.prototype.lineNumber")}}
Le numéro de la ligne du fichier qui a causé l'erreur. Propriété héritée depuis {{jsxref("Error")}}.
{{jsxref("Error.prototype.columnNumber", "SyntaxError.prototype.columnNumber")}}
Le numéro de la colonne dans la ligne qui a causé l'erreur. Propriété héritée depuis {{jsxref("Error")}}.
{{jsxref("Error.prototype.stack", "SyntaxError.prototype.stack")}}
La pile d'appels (stack trace). Propriété héritée depuis {{jsxref("Error")}}.

Méthodes

Bien que le prototype de {{jsxref("SyntaxError")}} ne possède pas de méthodes directes, les instances de {{jsxref("SyntaxError")}} héritent de certaines méthodes via la chaîne de prototypes.

Spécifications

Spécification Statut Commentaires
{{SpecName('ES3')}} {{Spec2('ES3')}} Définition initiale.
{{SpecName('ES5.1', '#sec-15.11.7.6', 'NativeError.prototype')}} {{Spec2('ES5.1')}} Définie comme NativeError.prototype.
{{SpecName('ES6', '#sec-nativeerror.prototype', 'NativeError.prototype')}} {{Spec2('ES6')}} Définie comme NativeError.prototype.
{{SpecName('ESDraft', '#sec-nativeerror.prototype', 'NativeError.prototype')}} {{Spec2('ESDraft')}} Définie comme NativeError.prototype.

Compatibilité des navigateurs

{{Compat("javascript.builtins.SyntaxError")}}

Voir aussi