String.prototype.strike() is a legacy HTML wrapper that returns a new string wrapping your text in <strike>…</strike>. It takes no parameters and never mutates the original string.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call string.strike. Start with this line.
JavaScript
string.strike()
Call
What it does
string.strike()
Primary signature.
string.strike(...)
Call with the arguments your case needs.
Built into JavaScript. Call strike(...) on a string (or String instance) — no import required.
Library declarations
JavaScript
string.strike()
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
HTML string with obsolete <strike> tags
JavaScript Examples
Example 1 — Basic Wrap
Call strike() to build the classic (obsolete) <strike> HTML string.
JavaScript
const text = "Hello, world";
console.log(text.strike());
// "<strike>Hello, world</strike>"
Empty input."".strike() still wraps tags around nothing → "<strike></strike>".
No escaping."A < B" keeps the < character inside the markup.
Type is string. You get text, not a live DOM element.
Safety tip. Never feed untrusted input through strike() into innerHTML.
Example 3 — Prefer DOM / CSS Instead
Compare the legacy wrapper with modern createElement("s") and CSS.
JavaScript
// Legacy — do not use in new code
console.log("old price".strike());
// "<strike>old price</strike>"
// Prefer a real <s> element
const el = document.createElement("s");
el.textContent = "old price";
console.log(el.outerHTML);
// "<s>old price</s>"
// Look-only alternative
const styled = document.createElement("span");
styled.textContent = "old price";
styled.style.textDecoration = "line-through";
console.log(styled.style.textDecoration); // "line-through"
Create a real element.createElement("s") + textContent is the safe DOM approach.
Look-only strikethrough. CSS text-decoration: line-through needs no special tag.
Rule of thumb. Learn strike() to read old code; ship <s>/<del>/CSS for new UI.
Compatibility
Browser & Runtime Support
String.prototype.strike() is still implemented widely for compatibility, but it is deprecated. Do not use it in new projects.
✓ Deprecated · Legacy
String.prototype.strike()
Available in major browsers and Node.js for legacy compatibility. Prefer DOM APIs or CSS text-decoration in new code.
LegacyCompatibility only
Google ChromeSupported · Legacy API
Legacy support
Mozilla FirefoxSupported · Legacy API
Legacy support
Apple SafariSupported · Legacy API
Legacy support
Microsoft EdgeSupported · Legacy API
Legacy support
Internet ExplorerSupported · Legacy
Legacy support
OperaSupported · Legacy API
Legacy support
Samsung InternetSupported · Android
Legacy support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Legacy support
strike()Avoid in new code
Bottom line: Recognize strike() when reading old code. For new UI, use createElement("s") / "del" or CSS text-decoration: line-through — never ship obsolete <strike> strings from string methods.
Frequently Asked Questions
strike() returns a new HTML string that wraps the text in a <strike> element — for example "Hello".strike() returns "<strike>Hello</strike>". It takes no parameters and does not change the original string.
Yes. MDN marks all HTML wrapper methods as deprecated. The <strike> element itself was also removed from the HTML specification. Prefer <s> or <del> created with document.createElement(), or CSS text-decoration: line-through.
Use <s> for content that is no longer accurate or relevant, and <del> for deleted content (often with edit history). For look-only strikethrough, use CSS text-decoration: line-through.
No. Strings are immutable. strike() returns a new string containing HTML markup. The original text stays the same.
Use document.createElement("s") or createElement("del"), set textContent, and append the element. Or apply CSS text-decoration: line-through without building HTML strings.
It remains widely available for compatibility, but you should not use it in new code. Prefer DOM APIs or CSS.