Using String strike() method to coding in Javascript/JS

This JavaScript tutorial explains how to use the string technique referred to as strike() with syntax and examples.


In JavaScript, strike() is a string approach that is used to create the HTML element. Because the strike() approach is a approach of the String object, it ought to be invoked thru a specific instance of the String class.


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


Parameters or Arguments

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


The strike() technique returns a replica of string enclosed in and tags.


The strike() technique does not alternate the value of the authentic string.


Let’s take a seem at an instance of how to use the strike() approach in JavaScript.

For example:

var totn_string = 'TechOnTheNet';


In this example, we have declared a variable called totn_string that is assigned the string value of ‘TechOnTheNet’. We have then invoked the strike() approach of the totn_string variable to return a string that consists of the HTML element.

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

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


As you can see, the strike() method created a string that carries a element. The price of the totn_string variable (which is ‘TechOnTheNet’) is enclosed inside the and tags.