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 −
<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>