--- title: String.prototype.fixed() slug: Web/JavaScript/Reference/Global_Objects/String/fixed tags: - JavaScript - String - метод - не рекомендований translation_of: Web/JavaScript/Reference/Global_Objects/String/fixed ---
Метод fixed()
створює HTML-елемент <tt>
, який відображає рядок моноширинним шрифтом.
str.fixed()
Рядок, що відображає HTML-елемент <tt>
.
Метод fixed()
вбудовує рядок у тег <tt>
: "<tt>str</tt>"
.
fixed()
Наступний приклад використовує метод fixed
, щоб змінити форматування рядка:
var worldString = 'Привіт'; console.log(worldString.fixed()); // "<tt>Привіт</tt>"
Специфікація |
---|
{{SpecName('ESDraft', '#sec-string.prototype.fixed', 'String.prototype.fixed')}} |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("javascript.builtins.String.fixed")}}