From cb9e359a51c3249d8f5157db69d43fd413ddeda6 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:45:12 +0100 Subject: unslug ca: move --- .../reference/global_objects/array/join/index.html | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 files/ca/web/javascript/reference/global_objects/array/join/index.html (limited to 'files/ca/web/javascript/reference/global_objects/array/join') diff --git a/files/ca/web/javascript/reference/global_objects/array/join/index.html b/files/ca/web/javascript/reference/global_objects/array/join/index.html new file mode 100644 index 0000000000..8d76b4474a --- /dev/null +++ b/files/ca/web/javascript/reference/global_objects/array/join/index.html @@ -0,0 +1,123 @@ +--- +title: Array.prototype.join() +slug: Web/JavaScript/Referencia/Objectes_globals/Array/join +translation_of: Web/JavaScript/Reference/Global_Objects/Array/join +--- +
{{JSRef}}
+ +

El mètode join() ajunta tots els elements d'un array en un string.

+ +

Sintaxi

+ +
str = arr.join([separador = ','])
+ +

Paràmetres

+ +
+
separador
+
Opcional. Expecifica un string que s'utilitzarà per a serparar cada element de l'array. El separador es converteix a string automàticament en cas necesari. Si s'omet, els elements de l'array seran separats per una coma. Si separador és un string buit, s'ajuntaran tots els elements de l'array sense cap caràcter entre ells.
+
+ +

Descripció

+ +

Ajunta les conversions a string de tots els elements de l'array en un sol string. Si un element és undefined o bé null aquest es converteix en una cadena buida.

+ +

Exemples

+ +

Quatre formes diferents d'ajuntar un array

+ +

L'exemple següent crea un array, a, amb tres elements, l'ajunta quatre cops: utilitzant el separador per defect, utilitzant coma i espai, utiltizant el signe més i utilitzant un string buit.

+ +
var a = ['Wind', 'Rain', 'Fire'];
+var myVar1 = a.join();      // assigna 'Wind,Rain,Fire' a myVar1
+var myVar2 = a.join(', ');  // assigna 'Wind, Rain, Fire' a myVar2
+var myVar3 = a.join(' + '); // assigna 'Wind + Rain + Fire' a myVar3
+var myVar4 = a.join('');    // assigna 'WindRainFire' a myVar4
+
+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.4.4.5', 'Array.prototype.join')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.join', 'Array.prototype.join')}}{{Spec2('ES6')}} 
+ +

Compatibilitat amb navegadors

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("1.0")}}{{CompatGeckoDesktop("1.7")}}{{CompatIE("5.5")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Vegeu també

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