[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/String/sup [Back]  [Original]

String.prototype.sup() - JavaScript | MDN

Esta pgina foi traduzida do ingls pela comunidade. Saiba mais e junte-se comunidade MDN Web Docs.

View in English Always switch to English

String.prototype.sup()

Deprecated

Avoid using this feature in new projects. HTML wrapper methods exist only for backwards compatibility. Use DOM APIs to create elements instead. This feature may be a candidate for removal from web standards or browsers.

Consider using the following features instead: DOM.

O mtodo sup() cria um elemento HTML <sup> que faz com que uma string seja exibida como sobrescrito.

In this article

Sintaxe

str.sup()

Valor retornado

Uma string contendo um elemento HTML <sup>.

Descrio

O mtodo sup() cria uma string dentro de uma tag <sup>: "<sup>str</sup>"

Exemplos

Usando os mtodos sub() e sup()

O exemplo a seguir usa os mtodos sub() e sup() para formatar uma string:

js
var superText = "superscript";
var supText = "supscript";

console.log("This is what a " + superText.sup() + " looks like.");
// "This is what a <sup>superscript</sup> looks like."

console.log("This is what a " + supText.sup() + " looks like.");
// "This is what a <sup>supscript</sup> looks like."

Especificaes

Specification
ECMAScript 2027 LanguageSpecification
# sec-string.prototype.sup

Compatibilidade com navegadores

Veja tambm


Web Proxy Viewer  |  New URL  |  Original Page