aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/string/touppercase/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/string/touppercase/index.html')
-rw-r--r--files/fr/web/javascript/reference/global_objects/string/touppercase/index.html107
1 files changed, 107 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/string/touppercase/index.html b/files/fr/web/javascript/reference/global_objects/string/touppercase/index.html
new file mode 100644
index 0000000000..9f456170cf
--- /dev/null
+++ b/files/fr/web/javascript/reference/global_objects/string/touppercase/index.html
@@ -0,0 +1,107 @@
+---
+title: String.prototype.toUpperCase()
+slug: Web/JavaScript/Reference/Objets_globaux/String/toUpperCase
+tags:
+ - JavaScript
+ - Méthode
+ - Prototype
+ - Reference
+ - String
+translation_of: Web/JavaScript/Reference/Global_Objects/String/toUpperCase
+---
+<div>{{JSRef}}</div>
+
+<p>La méthode <code><strong>toUpperCase()</strong></code> retourne la valeur de la chaîne courante, convertie en majuscules.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/string-touppercase.html")}}</div>
+
+<p class="hidden">Le code source de cet exemple interactif est disponible dans un dépôt GitHub. Si vous souhaitez contribuez à ces exemples, n'hésitez pas à cloner <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> et à envoyer une <em>pull request</em> !</p>
+
+<h2 id="Syntaxe">Syntaxe</h2>
+
+<pre class="syntaxbox"><var>str</var>.toUpperCase()</pre>
+
+<h3 id="Valeur_de_retour">Valeur de retour</h3>
+
+<p>Une nouvelle chaîne de caractères obtenue à partir de la chaîne appelante, passée en majuscules.</p>
+
+<h3 id="Exceptions_levées">Exceptions levées</h3>
+
+<dl>
+ <dt>{{jsxref("TypeError")}}</dt>
+ <dd>Une telle exception sera levée si on appelle cette méthode sur {{jsxref("null")}} ou {{jsxref("undefined")}} (en utilisant <code>Function.prototype.call()</code> par exemple).</dd>
+</dl>
+
+<h2 id="Description">Description</h2>
+
+<p>La méthode <code>toUpperCase()</code> retourne la valeur de la chaîne convertie en majuscules. <code>toUpperCase</code> n'affecte pas la valeur de la chaîne elle-même.</p>
+
+<h2 id="Exemples">Exemples</h2>
+
+<h3 id="Utiliser_toUpperCase()">Utiliser <code>toUpperCase()</code></h3>
+
+<pre class="brush: js">console.log( "alphabet".toUpperCase() ); // "ALPHABET"</pre>
+
+<h3 class="brush: js" id="Convertir_une_valeur_this_en_chaîne_de_caractères">Convertir une valeur <code>this</code> en chaîne de caractères</h3>
+
+<p class="brush: js">Cette peut être utilisée pour convertir une valeur qui n'est pas une chaîne de caractères lorsque celle-ci est fournie comme valeur <code>this</code> : ​​​​</p>
+
+<pre class="brush: js">var obj = {
+ toString: function toString(){
+ return 'abcdef';
+ }
+};
+var a = String.prototype.toUpperCase.call(obj);
+var b = String.prototype.toUpperCase.call(true);
+
+console.log(a); // Affiche 'ABCDEF' dans la console
+console.log(b); // Affiche 'TRUE' dans la console
+</pre>
+
+<h2 id="Spécifications">Spécifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Spécification</th>
+ <th scope="col">État</th>
+ <th scope="col">Commentaires</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ES1')}}</td>
+ <td>{{Spec2('ES1')}}</td>
+ <td>Définition initiale. Implémentée avec JavaScript 1.0.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.5.4.18', 'String.prototype.toUpperCase')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-string.prototype.touppercase', 'String.prototype.toUpperCase')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-string.prototype.touppercase', 'String.prototype.toUpperCase')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
+
+<p class="hidden">Le tableau de compatibilité de cette page a été généré à partir de données structurées. Si vous souhaitez contribuer à ces données, n'hésitez pas à envoyer une <em>pull request</em> sur <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
+
+<p>{{Compat("javascript.builtins.String.toUpperCase")}}</p>
+
+<h2 id="Voir_aussi">Voir aussi</h2>
+
+<ul>
+ <li>{{jsxref("String.prototype.toLocaleLowerCase()")}}</li>
+ <li>{{jsxref("String.prototype.toLocaleUpperCase()")}}</li>
+ <li>{{jsxref("String.prototype.toLowerCase()")}}</li>
+</ul>