MDN self-hosted library · e01.org

String.prototype.fixed()

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const contentString = "Hello, world";

document.body.innerHTML = contentString.fixed();
html
<tt>Hello, world</tt>
js
document.getElementById("yourElemId").style.fontFamily = "monospace";