Javascript - String bold() Method

The bold() method is used to display a string in bold. This method returns the string embedded in the <b> tag, like this:

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>

Syntax

string.bold()

Parameters

None

Return

A string embedded in the <b> tag

Example

Display a text in bold:

Demo

var str = "Hello World!";
var result = str.bold();
console.log(result);

Result