JavaScript bold()Method
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
![]()
![]()
![]()
![]()
![]()
All major browsers support the bold() method.
Examples
Examples
Display a string in bold:
<script>
var str = "Hello world!";
document.write(str.bold());
</script>
var str = "Hello world!";
document.write(str.bold());
</script>
Try it yourself »
JavaScript String Object Other Extensions