String.prototype.fixed()
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 método fixed() cria um elemento HTML <tt> que faz com que uma string seja exibida em uma fonte de densidade fixa.
Sintaxe
str.fixed()
Valor retornado
Uma string que representa o elemento HTML <tt>.
Descrição
O método fixed() cria uma string dentro de uma tag <tt>:
"<tt>str</tt>".
Exemplos
>Usando fixed()
O exemplo a seguir usa o método fixed() para alterar a formatação de uma string:
js
var worldString = "Olá, mundo";
console.log(worldString.fixed()); // "<tt>Olá, mundo</tt>"
Especificações
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-string.prototype.fixed> |