diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:36:08 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:36:08 +0100 |
commit | 39f2114f9797eb51994966c6bb8ff1814c9a4da8 (patch) | |
tree | 66dbd9c921f56e440f8816ed29ac23682a1ac4ef /files/fr/web/javascript/reference/global_objects/uneval/index.html | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.gz translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.bz2 translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.zip |
unslug fr: move
Diffstat (limited to 'files/fr/web/javascript/reference/global_objects/uneval/index.html')
-rw-r--r-- | files/fr/web/javascript/reference/global_objects/uneval/index.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/global_objects/uneval/index.html b/files/fr/web/javascript/reference/global_objects/uneval/index.html new file mode 100644 index 0000000000..fabc5b0cf1 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/uneval/index.html @@ -0,0 +1,69 @@ +--- +title: uneval() +slug: Web/JavaScript/Reference/Objets_globaux/uneval +tags: + - Fonction + - JavaScript + - Non-standard + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/uneval +--- +<div>{{jsSidebar("Objects")}}{{Non-standard_header}}</div> + +<p>La fonction <code><strong>uneval()</strong></code> renvoie une chaîne de caractères représentant le code source d'un objet.</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="syntaxbox">uneval(<var>objet</var>)</pre> + +<h3 id="Paramètres">Paramètres</h3> + +<dl> + <dt><code>objet</code></dt> + <dd>Une instruction ou une expression JavaScript.</dd> +</dl> + +<h3 id="Valeur_de_retour">Valeur de retour</h3> + +<p>Une chaîne de caractères qui représente le code source de l'objet indiqué.</p> + +<div class="note"><strong>Note :</strong> Le résultat obtenu ne sera pas une représentation JSON valide de l'objet.</div> + +<h2 id="Description">Description</h2> + +<p><code>uneval()</code> est une fonction disponible au plus haut niveau et n'est rattachée à aucun objet.</p> + +<h2 id="Exemples">Exemples</h2> + +<pre class="brush:js">var a = 1; +uneval(a); // renvoie une chaîne qui contient 1 + +var b = "1"; +uneval(b) // renvoie une chaîne qui contient "1" + +uneval(function toto(){}); // renvoie "(function toto(){})" + + +var a = uneval(function toto(){return 'salut'}); +var toto = eval(a); +toto(); // renvoie "salut" +</pre> + +<h2 id="Spécifications">Spécifications</h2> + +<p>Cette méthode ne fait partie d'aucune spécification.</p> + +<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> + +<div class="hidden">Ce tableau de compatibilité 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>.</div> + +<p>{{Compat("javascript.builtins.uneval")}}</p> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<ul> + <li>{{jsxref("Objets_globaux/eval", "eval()")}}</li> + <li>{{jsxref("JSON.stringify()")}}</li> + <li>{{jsxref("JSON.parse()")}}</li> + <li>{{jsxref("Object.toSource()")}}</li> +</ul> |