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

El mètode endsWith() method determina si un string acaba amb els caràcters d'un altre string, retornant true o false depenent d'això.

- -

Sintaxi

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

Paràmetres

- -
-
stringAcercar
-
Els caràcters a cercar al final d'aquest string.
-
posició
-
Opcional. Cerca dins aquest string considerant posició com la última posició del string; per defecte rep el valor del tamany total del string.
-
 
-
 
-
- -

Descripció

- -

Aquest mètode us permet determinar si un string acaba en un altre string.

- -

Exemples

- -

Utilitzar endsWith()

- -
var str = 'To be, or not to be, that is the question.';
-
-console.log(str.endsWith('question.')); // true
-console.log(str.endsWith('to be'));     // false
-console.log(str.endsWith('to be', 19)); // 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.endsWith():

- -
if (!String.prototype.endsWith) {
-  String.prototype.endsWith = function(searchString, position) {
-      var subjectString = this.toString();
-      if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
-        position = subjectString.length;
-      }
-      position -= searchString.length;
-      var lastIndex = subjectString.indexOf(searchString, position);
-      return lastIndex !== -1 && lastIndex === position;
-  };
-}
-
- -

Especificacions

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

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("41")}}{{CompatGeckoDesktop("17")}}{{CompatNo}}{{CompatNo}}{{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