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

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

Description

In JavaScript, italics() is a string technique that is used to create the HTML element. Because the italics() method is a method of the String object, it should be invoked via a specific instance of the String class.

Syntax

In JavaScript, the syntax for the italics() approach is:

string.italics();

Parameters or Arguments

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

Returns

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

Note

The italics() technique does not exchange the price of the original string.

Example

Let’s take a appear at an example of how to use the italics() method in JavaScript.

For example:

var totn_string = 'TechOnTheNet';

console.log(totn_string.italics());

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

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

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

<i>TechOnTheNet</i>

As you can see, the italics() approach created a string that contains an element. The fee of the totn_string variable (which is ‘TechOnTheNet’) is enclosed within the and tags.