JavaScript > Methods

Bold style in JavaScript

How to apply bold style to the text in JavaScript?


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

<script>
        document.write("This is Bold text ");
        document.write(" This is Bold text".bold());
</script>

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

OUTPUT

 Views: 4286 | Post Order: 45



Write for us






Hosting Recommendations