JavaScript bold()Method

String 对象参考手册JavaScript String Object

Definition and Usage

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

This method returns the string wrapped in a <b> tag, as follows:

<b>string</b>

Syntax

string.bold()


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the bold() method.


Examples

Examples

Display a string in bold:

<script>

var str = "Hello world!";
document.write(str.bold());

</script>

Try it yourself »


String 对象参考手册JavaScript String Object Other Extensions