String bold() Method - Javascript String

Javascript examples for String:bold

Description

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>

Parameters

None.

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>
<html>
<body>

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

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

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

</body>
</html>

Related Tutorials