Javascript - String italics() Method

The italics() method is used to display a string in italic.

Description

The italics() method is used to display a string in italic.

This method returns the string embedded in the <i> tag, like this:

<i>string</i>

Syntax

string.italics()

Parameters

None

Return

A string embedded in the <i> tag

Example

Display the text in italic:

Demo

//display a string in italic.
var str = "Hello World!";
var result = str.italics();
console.log(result);//from w ww  .  j  a va 2  s . c  o  m

Result