JavaScript > Methods

Italic style in JavaScript

How to apply italic style to the text in JavaScript?


In case we want to apply the italic style to the text in the html page, we can use this approach.

<script>
        document.write("This is Italic text ");
        document.write(" This is Italic text".italics());
</script>

In the above code snippet, we have written “This is Italic text” in both document.write lines but in the 2nd statement we have called the italics() method using the text that makes this text in italic style as you can see in the below picture.

OUTPUT

 Views: 4131 | Post Order: 46



Write for us






Hosting Recommendations