From 844f5103992238c0c23203286dad16a466e89c97 Mon Sep 17 00:00:00 2001 From: julieng Date: Tue, 3 Aug 2021 08:03:09 +0200 Subject: move *.html to *.md --- .../global_objects/string/concat/index.html | 103 --------------------- 1 file changed, 103 deletions(-) delete mode 100644 files/fr/web/javascript/reference/global_objects/string/concat/index.html (limited to 'files/fr/web/javascript/reference/global_objects/string/concat/index.html') diff --git a/files/fr/web/javascript/reference/global_objects/string/concat/index.html b/files/fr/web/javascript/reference/global_objects/string/concat/index.html deleted file mode 100644 index 8958a7491f..0000000000 --- a/files/fr/web/javascript/reference/global_objects/string/concat/index.html +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: String.prototype.concat() -slug: Web/JavaScript/Reference/Global_Objects/String/concat -tags: - - JavaScript - - Méthode - - Prototype - - Reference - - String -translation_of: Web/JavaScript/Reference/Global_Objects/String/concat -original_slug: Web/JavaScript/Reference/Objets_globaux/String/concat ---- -
{{JSRef}}
- -

La méthode concat() combine le texte de plusieurs chaînes avec la chaîne appelante et renvoie la nouvelle chaîne ainsi formée.

- -
{{EmbedInteractiveExample("pages/js/string-concat.html")}}
- -

Syntaxe

- -
str.concat(string2[, string3, ..., stringN])
- -

Paramètres

- -
-
string2...stringN
-
Chaînes de caractères à concaténer ensemble.
-
- -

Valeur de retour

- -

Une nouvelle chaîne de caractères qui contient la concaténation des chaînes de caractères fournies.

- -

Description

- -

La fonction concat() renvoie une nouvelle chaîne correspondant à la concaténation des différents arguments avec la chaîne courante. La chaîne courante est celle sur laquelle a été appelée la méthode concat(). Si les valeurs passées en arguments ne sont pas des chaînes de caractères, elles sont automatiquement converties en chaînes (grâce à leur méthode toString() avant la concaténation).

- -

Exemples

- -

L'exemple suivant combine plusieurs chaînes afin d'en former une nouvelle.

- -
var coucou = "Bonjour ";
-console.log(coucou.concat("Tristan,", " bonne journée."));
-
-/* Bonjour Tristan, bonne journée. */
-
-var salutation = ['Bonjour', ' ', 'Alfred', ' ', '!'];
-"".concat(...salutation); // "Bonjour Alfred !"
-
-"".concat({});   // [object Object]
-"".concat([]);   // ""
-"".concat(null); // "null"
-"".concat(true); // "true"
-"".concat(4, 5); // "45"
-
-
- -

Performance

- -

Il est fortement recommandé d'utiliser les {{jsxref("Opérateurs/Opérateurs_d_affectation", "opérateurs d'affectation", "", 1)}} (+, +=) plutôt que la méthode concat() pour des raisons de performance.

- -

Spécifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpécificationÉtatCommentaires
{{SpecName('ES3')}}{{Spec2('ES3')}}Définition initiale. Implémentée avec JavaScript 1.2.
{{SpecName('ES5.1', '#sec-15.5.4.6', 'String.prototype.concat')}}{{Spec2('ES5.1')}}
{{SpecName('ES6', '#sec-string.prototype.concat', 'String.prototype.concat')}}{{Spec2('ES6')}}
{{SpecName('ESDraft', '#sec-string.prototype.concat', 'String.prototype.concat')}}{{Spec2('ESDraft')}}
- -

Compatibilité des navigateurs

- -

{{Compat("javascript.builtins.String.concat")}}

- -

Voir aussi

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