--- title: String.prototype.sup() slug: Web/JavaScript/Reference/Global_Objects/String/sup tags: - Descontinuado - JavaScript - Prototipo - Referencia - String - metodo - sup() translation_of: Web/JavaScript/Reference/Global_Objects/String/sup ---
O método sup()
cria um elemento HTML <sup>
que faz com que uma string seja exibida como sobrescrito.
str.sup()
Uma string contendo um elemento HTML <sup>
.
O método sup()
cria uma string dentro de uma tag <sup>
: "<sup>str</sup>"
sub()
e sup()
O exemplo a seguir usa os métodos {{jsxref("String.prototype.sub()", "sub()")}} e sup()
para formatar uma string:
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."
Specification |
---|
{{SpecName('ESDraft', '#sec-string.prototype.sup', 'String.prototype.sup')}} |
{{Compat("javascript.builtins.String.sup")}}