--- title: String.prototype.fixed() slug: Web/JavaScript/Reference/Global_Objects/String/fixed tags: - Descontinuado - JavaScript - Prototipo - Referencia - String - fixed() - metodo translation_of: Web/JavaScript/Reference/Global_Objects/String/fixed ---
O método fixed() cria um elemento HTML <tt> que faz com que uma string seja exibida em uma fonte de densidade fixa.
str.fixed()
Uma string que representa o elemento HTML <tt>.
O método fixed() cria uma string dentro de uma tag <tt>:
"<tt>str</tt>".
fixed()O exemplo a seguir usa o método fixed() para alterar a formatação de uma string:
var worldString = 'Olá, mundo'; console.log(worldString.fixed()); // "<tt>Olá, mundo</tt>"
| Specification |
|---|
| {{SpecName('ESDraft', '#sec-string.prototype.fixed', 'String.prototype.fixed')}} |
{{Compat("javascript.builtins.String.fixed")}}