totn JavaScript

JavaScript: String blink() method

This JavaScript tutorial explains how to use the string method called blink() with syntax and examples.

Description

In JavaScript, blink() is a string method that is used to create the HTML <blink> element. Because the blink() method is a method of the String object, it must be invoked through a particular instance of the String class.

Syntax

In JavaScript, the syntax for the blink() method is:

string.blink();

Parameters or Arguments

There are no parameters or arguments for the blink() method.

Returns

The blink() method returns a copy of string enclosed in <blink> and </blink> tags.

Note

  • The blink() method does not change the value of the original string.

Example

Let's take a look at an example of how to use the blink() method in JavaScript.

For example:

var totn_string = 'TechOnTheNet';

console.log(totn_string.blink());

In this example, we have declared a variable called totn_string that is assigned the string value of 'TechOnTheNet'. We have then invoked the blink() method of the totn_string variable to return a string that contains the HTML <blink> element.

We have written the output of the blink() method to the web browser console log, for demonstration purposes, to show what the blink() method returns.

The following will be output to the web browser console log:

<blink>TechOnTheNet</blink>

As you can see, the blink() method created a string that contains a <blink> element. The value of the totn_string variable (which is 'TechOnTheNet') is enclosed within the <blink> and </blink> tags.