JavaScript String - italics() Method


Advertisements


Description

This method causes a string to be italic, as if it were in an <i> tag

Syntax

Its syntax is as follows −

string.italics( )

Return Value

Returns the string with <i> tag.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript String italics() Method</title>
   </head>
   
   <body>
   
      <script type="text/javascript">
         var str = new String("Hello world");
         alert(str.italics( 3 ));
      </script>
      
   </body>
</html>

Output

<i>Hello world</i>

javascript_strings_object.htm