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 the compatibility 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étodo fixed() cria um elemento HTML <tt> (en-US) 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> (en-US).

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 Language Specification
# sec-string.prototype.fixed

Compatibilidade com navegadores

BCD tables only load in the browser

Veja também