Javascript - String fontsize() Method

The fontsize() method can display a string in a specified size.

Description

The fontsize() method can display a string in a specified size.

This method returns the string embedded in the <font> tag, like this:

<font size="size">string</font>

Syntax

string.fontsize(size)

Parameter Values

Parameter Require Description
size Required. An integer between 1 and 7 that specifies the font size

Return

A string embedded in the <font> tag

Example

Display the text in a large font-size:

Demo

//display a string in a specified size.
var str = "Hello World!";
var result = str.fontsize(7);
console.log(result);/*from   w w  w  .j  a  va  2  s .com*/

Result