pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/String/toString

ref="https://developer.mozilla.org/favicon.ico" />

Cette page a été traduite à partir de l'anglais par la communauté. Vous pouvez contribuer en rejoignant la communauté francophone sur MDN Web Docs.

View in English Always switch to English

String.prototype.toString()

Baseline Widely available

Cette fonctionnalité est bien établie et fonctionne sur de nombreux appareils et versions de navigateurs. Elle est disponible sur tous les navigateurs depuis juillet 2015.

La méthode toString() renvoie une chaine de caractères représentant l'objet renseigné.

Exemple interactif

const stringObj = new String("foo");

console.log(stringObj);
// Expected output: String { "foo" }

console.log(stringObj.toString());
// Expected output: "foo"

Syntaxe

js
str.toString();

Valeur de retour

Une chaîne de caractères représentant la chaîne appelante.

Description

L'objet String surcharge la méthode toString() de l'objet Object ; il n'hérite pas de Object.prototype.toString(). Pour Les objets String, la méthode toString() renvoie une chaine de caractères représentant l'objet, et est similaire à la méthode String.prototype.valueOf().

Exemples

L'exemple suivant affiche la valeur textuelle d'un objet String :

js
var x = new String("coucou monde");
console.log(x.toString()); // affiche "coucou monde"

Spécifications

Specification
ECMAScript® 2026 Language Specification
# sec-string.prototype.tostring

Compatibilité des navigateurs

Voir aussi

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy