Using String bold() method to coding in Javascript/JS

This JavaScript tutorial explains how to use the string technique referred to as bold() with syntax and examples.

Description

In JavaScript, bold() is a string method that is used to create the HTML element. Because the bold() approach is a technique of the String object, it should be invoked through a precise occasion of the String class.

Syntax

In JavaScript, the syntax for the bold() approach is:

string.bold();

Parameters or Arguments

There are no parameters or arguments for the bold() method.

Returns

The bold() approach returns a reproduction of string enclosed in and tags.

Note

The bold() technique does not trade the cost of the authentic string.

Example

Let’s take a look at an instance of how to use the bold() approach in JavaScript.

For example:

var totn_string = 'TechOnTheNet';

console.log(totn_string.bold());

In this example, we have declared a variable called totn_string that is assigned the string price of ‘TechOnTheNet’. We have then invoked the bold() approach of the totn_string variable to return a string that includes the HTML element.

We have written the output of the bold() approach to the internet browser console log, for demonstration purposes, to show what the bold() approach returns.

The following will be output to the web browser console log:

<b>TechOnTheNet</b>

As you can see, the bold() technique created a string that incorporates a element. The fee of the totn_string variable (which is ‘TechOnTheNet’) is enclosed within the and tags.