String bold() Method - Javascript String

Javascript examples for String:bold


The bold() method is used to display a string in bold.

This method returns the string embedded in the <b> tag, like this:<b>string</b>



Return Value:

A string embedded in the <b> tag

The following code shows how to Display a text in bold:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {// w  w w . j  ava  2s. co m
    var str = "Hello World!";
    var result = str.bold();
    document.getElementById("demo").innerHTML = result;


Related Tutorials