From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../global_objects/string/startswith/index.html | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/string/startswith/index.html (limited to 'files/fr/web/javascript/reference/global_objects/string/startswith/index.html') diff --git a/files/fr/web/javascript/reference/global_objects/string/startswith/index.html b/files/fr/web/javascript/reference/global_objects/string/startswith/index.html new file mode 100644 index 0000000000..060bd27d32 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/string/startswith/index.html @@ -0,0 +1,87 @@ +--- +title: String.prototype.startsWith() +slug: Web/JavaScript/Reference/Objets_globaux/String/startsWith +tags: + - ECMAScript6 + - JavaScript + - Méthode + - Prototype + - Reference + - String + - polyfill +translation_of: Web/JavaScript/Reference/Global_Objects/String/startsWith +--- +
{{JSRef}}
+ +

La méthode startsWith() renvoie un booléen indiquant si la chaine de caractères commence par la deuxième chaine de caractères fournie en argument.

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

Syntaxe

+ +
str.startsWith(chaîneRecherchée [, position]);
+ +

Paramètres

+ +
+
chaîneRecherchée
+
Les caractères à rechercher au début de la chaine de caractères.
+
position {{optional_inline}}
+
La position à laquelle commencer la recherche de chaîneRecherchée ; par défaut 0.
+
+ +

Valeur de retour

+ +

true si la chaîne de caractères commence avec la sous-chaîne en argument, false sinon

+ +

Description

+ +

Cette méthode permet de savoir si une chaine de caractères commence avec une autre chaine de caractères (comme pour les autres méthodes fonctionnant avec les chaînes de caractères, cette méthode est sensible à la casse).

+ +

Exemples

+ +
var str = "Être, ou ne pas être : telle est la question.";
+
+console.log(str.startsWith("Être"));         // true
+console.log(str.startsWith("pas être"));     // false
+console.log(str.startsWith("pas être", 12)); // true
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-string.prototype.startswith', 'String.prototype.startsWith')}}{{Spec2('ESDraft')}}
+ +

Compatibilité des navigateurs

+ + + +

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

+ +

Voir aussi

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