| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/String/sub | [Back] [Original] |
Get to know MDN better
Cette page a t traduite partir de l'anglais par la communaut. Vous pouvez contribuer en rejoignant la communaut francophone sur MDN Web Docs.
vitez d'utiliser cette fonctionnalit dans de nouveaux projets. HTML wrapper methods exist only for backwards compatibility. Use DOM APIs to create elements instead. Cette fonctionnalit peut tre candidate la suppression des standards web ou des navigateurs.
Envisagez d'utiliser plutt les fonctionnalits suivantes : DOM.
La mthode sub() cre un lment HTML <sub> qui entrane l'affichage de la chane en indice.
str.sub();
Une chane de caractres reprsentant un lment HTML <sub>.
La mthode sub encapsule une chane dans une balise <sub> :
"<sub>str</sub>".
L'exemple suivant utilise les mthodes sub() et sup() pour mettre en forme une chane :
var superText = "exposant";
var subText = "indice";
console.log("Ceci illustre l'affichage d'un texte en " + superText.sup() + ".");
// "Ceci illustre l'affichage d'un texte en <sup>expostant</sup>
console.log("Ceci illustre l'affichage d'un texte en " + subText.sub() + ".");
// "Ceci illustre l'affichage d'un texte en <sub>indice</sub>
| Spcification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-string.prototype.sub |
Cette page a t modifie le 3 aot 2023 par les contributeurices du MDN.
StringString.prototype.anchor()String.prototype.at()String.prototype.big()String.prototype.blink()String.prototype.bold()String.prototype.charAt()String.prototype.charCodeAt()String.prototype.codePointAt()String.prototype.concat()String.prototype.endsWith()String.prototype.fixed()String.prototype.fontcolor()String.prototype.fontsize()String.prototype.includes()String.prototype.indexOf()isWellFormed()String.prototype.italics()String.prototype.lastIndexOf()String.prototype.link()String.prototype.localeCompare()String.prototype.match()String.prototype.matchAll()String.prototype.normalize()String.prototype.padEnd()String.prototype.padStart()String.prototype.repeat()String.prototype.replace()String.prototype.replaceAll()String.prototype.search()String.prototype.slice()String.prototype.small()String.prototype.split()String.prototype.startsWith()String.prototype.strike()String.prototype.sub()String.prototype.substr()String.prototype.substring()String.prototype.sup()String.prototype.toLocaleLowerCase()String.prototype.toLocaleUpperCase()String.prototype.toLowerCase()String.prototype.toString()String.prototype.toUpperCase()toWellFormed()String.prototype.trim()String.prototype.trimEnd()String.prototype.trimStart()String.prototype.valueOf()String.prototype[@@iterator]()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Certaines parties de ce contenu sont protges par le droit d'auteur 19982026 des contributeurs individuels de mozilla.org. Contenu disponible sous une licence Creative Commons.
| Web Proxy Viewer | New URL | Original Page |