From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../global_objects/array/tostring/index.html | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/array/tostring/index.html (limited to 'files/fr/web/javascript/reference/global_objects/array/tostring') diff --git a/files/fr/web/javascript/reference/global_objects/array/tostring/index.html b/files/fr/web/javascript/reference/global_objects/array/tostring/index.html new file mode 100644 index 0000000000..b7b252c1fb --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/array/tostring/index.html @@ -0,0 +1,83 @@ +--- +title: Array.prototype.toString() +slug: Web/JavaScript/Reference/Objets_globaux/Array/toString +tags: + - Array + - JavaScript + - Méthode + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Array/toString +--- +
{{JSRef}}
+ +

La méthode toString() renvoie une chaine de caractères représentant le tableau spécifié et ses éléments.

+ +
{{EmbedInteractiveExample("pages/js/array-tostring.html")}}
+ + + +

Syntaxe

+ +
arr.toString()
+ +

Valeur de retour

+ +

Une chaîne de caractères qui représente les éléments du tableau.

+ +

Description

+ +

L'objet {{jsxref("Array")}} redéfinit la méthode toString d'{{jsxref("Object")}}. Pour les objets Array, la méthode toString() concatène les éléments du tableau et renvoie une chaîne contenant chacun des éléments, séparés par des virgules.

+ +

JavaScript appelle la méthode toString() automatiquement lorsqu'un tableau doit être représenté par une valeur texte ou lorsqu'on fait référence à un tableau dans une concaténation de chaines de caractères.

+ +

Sémantique d'ECMAScript 5

+ +

À partir de JavaScript 1.8.5 (Firefox 4), et en cohérence avec la 5e édition d'ECMAScript, la méthode toString() est générique et peut être utilisé avec n'importe quel objet. {{jsxref("Object.prototype.toString()")}} sera appelée, et la valeur résultante sera renvoyée.

+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES1')}}{{Spec2('ES1')}}Définition initiale. Implémentée avec JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.4.4.2', 'Array.prototype.toString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.tostring', 'Array.prototype.toString')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.prototype.tostring', 'Array.prototype.toString')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ +
+ + +

{{Compat("javascript.builtins.Array.toString")}}

+
+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf