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/string/startswith/index.html | 129 --------------------- 1 file changed, 129 deletions(-) delete mode 100644 files/ca/web/javascript/reference/global_objects/string/startswith/index.html (limited to 'files/ca/web/javascript/reference/global_objects/string/startswith') diff --git a/files/ca/web/javascript/reference/global_objects/string/startswith/index.html b/files/ca/web/javascript/reference/global_objects/string/startswith/index.html deleted file mode 100644 index e96aabc68a..0000000000 --- a/files/ca/web/javascript/reference/global_objects/string/startswith/index.html +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: String.prototype.startsWith() -slug: Web/JavaScript/Reference/Global_Objects/String/startsWith -translation_of: Web/JavaScript/Reference/Global_Objects/String/startsWith -original_slug: Web/JavaScript/Referencia/Objectes_globals/String/startsWith ---- -
{{JSRef}}
- -

El mètode startsWith() determina si un string comença amb els caràcters d'un altre string, retornant true o false depenent d'això.

- -

Sintaxi

- -
str.startsWith(stringAcercar[, posició])
- -

Paràmetres

- -
-
stringAcercar
-
Els caràcters a cercar al començament d'aquest string.
-
posició
-
Opcional. La posició dins el string a la qual es començarà a cercar per a trobar stringAcercar; per defecte és 0.
-
- -

Descripció

- -

Aquest mètode us permet determinar si un string comença amb un altre string.

- -

Exemples

- -

Utilitzar startsWith()

- -
var str = 'To be, or not to be, that is the question.';
-
-console.log(str.startsWith('To be'));         // true
-console.log(str.startsWith('not to be'));     // false
-console.log(str.startsWith('not to be', 10)); // true
-
- -

Polyfill

- -

Aquest mètode va ser afegit a l'especificació ECMAScript i pot no estar disponible encara a totes les implementacions de JavaScript. No obstant, la funció següent emula el comportament de String.prototype.startsWith():

- -
if (!String.prototype.startsWith) {
-  String.prototype.startsWith = function(searchString, position) {
-    position = position || 0;
-    return this.indexOf(searchString, position) === position;
-  };
-}
-
- -

Trobareu una funció Polyfill més robusta i optimitzada al GitHub de Mathias Bynens.

- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("41")}}{{CompatGeckoDesktop("17")}}{{CompatNo}}{{CompatChrome("41")}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatChrome("36")}}{{CompatGeckoMobile("17")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

Vegeu també

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