JavaScript String fontcolor() Method

Definition and Usage

The String fontcolor() method in JavaScript is deprecated.

Avoid using it.

It may stop running at any time in your browser.

fontcolor() The method returns a string embedded in <font> tags:

<font color="colorvalue">string</font>

HTML5 does not support the <font> tag.

Example

let text = "Hello World!";
let result = text.fontcolor("green");

Try It Yourself

Syntax

string.fontcolor("color)

Parameter

Parameter Description
color Required. RGB or hexadecimal color value.

Return Value

String embedded in the <font> tag.