JavaScript String blink() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Method

Definition

String.prototype.blink() is a legacy HTML wrapper that returns a new string wrapping your text in <blink>…</blink>. 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.blink. Start with this line.

JavaScript
string.blink()
CallWhat it does
string.blink()Primary signature.
string.blink(...)Call with the arguments your case needs.

Built into JavaScript. Call blink(...) on a string (or String instance) — no import required.

Library declarations
JavaScript
string.blink()

Parameters

This member has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*HTML string with <blink> tags

JavaScript Examples

Example 1 — Basic Wrap

Call blink() to build the classic <blink> HTML string.

JavaScript
const text = "Hello, world";

console.log(text.blink());
// "<blink>Hello, world</blink>"
Try It Yourself

How It Works

  1. Start with text. "Hello, world" is a normal string.
  2. Call blink(). No arguments — the method wraps the whole string.
  3. Get HTML markup. The return value is "<blink>Hello, world</blink>".
  4. Original stays put. text is still "Hello, world".

Example 2 — Empty String & Special Characters

See empty wrappers and that < is not escaped.

JavaScript
console.log("".blink());       // "<blink></blink>"
console.log("A < B".blink());  // "<blink>A < B</blink>"
console.log(typeof "x".blink()); // "string"
Try It Yourself

How It Works

  1. Empty input. "".blink() still wraps tags around nothing → "<blink></blink>".
  2. No escaping. "A < B" keeps the < character inside the markup.
  3. Type is string. You get text, not a live DOM element.
  4. Safety tip. Never feed untrusted input through blink() into innerHTML.

Example 3 — Prefer Static Emphasis

Compare the legacy wrapper with a modern, accessible approach.

JavaScript
// Legacy — do not use in new code
console.log("Alert".blink());
// "<blink>Alert</blink>"

// Prefer static emphasis (no blinking)
const el = document.createElement("strong");
el.textContent = "Alert";
console.log(el.outerHTML);
// "<strong>Alert</strong>"
Try It Yourself

How It Works

  1. Legacy path. "Alert".blink() builds obsolete <blink> markup that does not animate today.
  2. Create a real element. createElement("strong") makes semantic emphasis.
  3. Set plain text. textContent is safe and accessible — no flashing.
  4. Rule of thumb. Learn blink() to read old code; never ship blinking text.

Browser & Runtime Support

String.prototype.blink() may still return a string for compatibility, but it is deprecated. The <blink> element itself no longer blinks in modern browsers.

✓ Deprecated · Legacy

String.prototype.blink()

Method may exist for legacy compatibility. The blink visual effect was removed from modern browsers. Do not use in new projects.

Legacy Compatibility only
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
blink() Avoid in new code

Bottom line: Recognize blink() when reading old code. For new UI, use static emphasis — never ship blinking text from string methods or CSS without a strong accessibility review.

Frequently Asked Questions

blink() returns a new HTML string that wraps the text in a <blink> element — for example "Hello".blink() returns "<blink>Hello</blink>". It takes no parameters and does not change the original string.
Yes. MDN marks all HTML wrapper methods as deprecated. The <blink> element was removed from modern browsers. Avoid blinking text for accessibility reasons.
No in modern browsers. The method may still return a <blink> string for compatibility, but the element no longer blinks. Do not rely on it for visual effects.
No. Strings are immutable. blink() returns a new string containing markup; the original text stays the same.
Do not blink text. Prefer static emphasis with color, weight, or size. If motion is truly required, use a careful CSS animation and respect prefers-reduced-motion.
No. Characters like < and > are left as-is inside the wrapper. Never pass untrusted user input through blink() into innerHTML.

Next: bold()

Another deprecated HTML wrapper — this one builds <b> markup.

bold() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful