MDN self-hosted library · e01.org

String.prototype.strike()

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.strike();
html
<strike>Hello, world</strike>
js
const contentString = "Hello, world";
const elem = document.createElement("s");
elem.innerText = contentString;
document.body.appendChild(elem);