From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- .../global_objects/array/shift/index.html | 130 --------------------- 1 file changed, 130 deletions(-) delete mode 100644 files/ca/web/javascript/reference/global_objects/array/shift/index.html (limited to 'files/ca/web/javascript/reference/global_objects/array/shift/index.html') diff --git a/files/ca/web/javascript/reference/global_objects/array/shift/index.html b/files/ca/web/javascript/reference/global_objects/array/shift/index.html deleted file mode 100644 index b02863aa85..0000000000 --- a/files/ca/web/javascript/reference/global_objects/array/shift/index.html +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Array.prototype.shift() -slug: Web/JavaScript/Reference/Global_Objects/Array/shift -translation_of: Web/JavaScript/Reference/Global_Objects/Array/shift -original_slug: Web/JavaScript/Referencia/Objectes_globals/Array/shift ---- -
{{JSRef}}
- -

El mètode shift() elimina el primer element d'un array i retorna l'element eliminat. Aquest mètode canvia el tamany de l'array.

- -

Sintaxi

- -
arr.shift()
- -

Descripció

- -

El mètode shift elimina l'element de l'array situat a la posició zero i mou la resta d'elements a la posició immediatament menor, tot seguit retorna el valor de l'element eliminat. Si la propietat {{jsxref("Array.length", "length")}} de l'array és 0, aquest mètode retornarà {{jsxref("undefined")}}.

- -

shift és generic de forma intencionada; aquest mètode pot ser {{jsxref("Function.call", "cridat", "", 1)}} o bé {{jsxref("Function.apply", "aplicat", "", 1)}} a objectes que es comportin com a arrays. Els objectes que no continguin una propietat length que reflecteixi l'última propietat numèrica poden tenir un comportament erràtic.

- -

Exemples

- -

Eliminar un element d'un array

- -

El codi següent mostra l'array myFish abans i després d'eliminar el seu primer element. També mostra l'element eliminat:

- -
var myFish = ['angel', 'clown', 'mandarin', 'surgeon'];
-
-console.log('myFish abans: ' + myFish);
-// "myFish abans: angel,clown,mandarin,surgeon"
-
-var shifted = myFish.shift();
-
-console.log('myFish després: ' + myFish);
-// "myFish després: clown,mandarin,surgeon"
-
-console.log('Element eliminat: ' + shifted);
-// "Element eliminat: angel"
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES3')}}{{Spec2('ES3')}}Definició inicial. Implementat a JavaScript 1.2.
{{SpecName('ES5.1', '#sec-15.4.4.9', 'Array.prototype.shift')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-array.prototype.shift', 'Array.prototype.shift')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-array.prototype.shift', 'Array.prototype.shift')}}{{Spec2('ESDraft')}} 
- -

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