Esta página foi traduzida do inglês pela comunidade.Saiba mais e junte-se à comunidade MDN Web Docs.
String.prototype.fixed()
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see thecompatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
O métodofixed() cria um elemento HTML<tt> que faz com que uma string seja exibida em uma fonte de densidade fixa.
In this article
Sintaxe
str.fixed()
Valor retornado
Uma string que representa o elemento HTML<tt>.
Descrição
O métodofixed() cria uma string dentro de uma tag<tt>:"<tt>str</tt>".
Exemplos
>Usandofixed()
O exemplo a seguir usa o métodofixed() para alterar a formatação de uma string:
var worldString = "Olá, mundo";console.log(worldString.fixed()); // "<tt>Olá, mundo</tt>"Especificações
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-string.prototype.fixed> |