How to make a text italic using JavaScript?

JavascriptWeb DevelopmentFront End Technology

To make text italic using JavaScript, use the italics() method. This method causes a string to be italic as if it were in an <i> tag.

Example

You can try to run the following code to make a text italic with JavaScript −

Live Demo

<html>
   <head>
      <title>JavaScript String italics() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Demo Text");
         document.write(str.italics());
         alert(str.italics());
      </script>
   </body>
</html>
raja
Published on 18-Jan-2018 12:29:14
Advertisements