How to create a bold text using JavaScript?

JavascriptWeb DevelopmentFront End Technology

To create a bold text using JavaScript, use the bold() text. This method causes a string to be displayed as bold as if it were in a <b> tag.

Example

You can try to run the following code to create a bold text with JavaScript −

Live Demo

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

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