recursal/MDN huggingface dataset:
String.prototype.fixed()
========================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`fixed()`** method of `String` values creates a string that embeds this string in a `<tt>` element (`<tt>str</tt>`), which causes this string to be displayed in a fixed-width font.

**Note:** All HTML wrapper methods are deprecated and only standardized for compatibility purposes. For the case of `fixed()`, the `<tt>` element itself has been removed from the HTML specification and shouldn't be used anymore. Web developers should use CSS properties instead.

Syntax
------


```js
fixed()
```

### Parameters

None.

### Return value

A string beginning with a `<tt>` start tag, then the text `str`, and then a `</tt>` end tag.

Examples
--------

### Using fixed()

The code below creates an HTML string and then replaces the document's body with it:


```js
const contentString = "Hello, world";

document.body.innerHTML = contentString.fixed();
```


This will create the following HTML:


```html
<tt>Hello, world</tt>
```


**Warning:** This markup is invalid, because `tt` is no longer a valid element.

Instead of using `fixed()` and creating HTML text directly, you should use CSS to manipulate fonts. For example, you can manipulate `font-family` through the `element.style` attribute:


```js
document.getElementById("yourElemId").style.fontFamily = "monospace";
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.fixed |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.fixed` in `core-js`
* HTML wrapper methods
* `<tt>`
String.prototype.strike()
=========================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`strike()`** method of `String` values creates a string that embeds this string in a `<strike>` element (`<strike>str</strike>`), which causes this string to be displayed as struck-out text.

**Note:** All HTML wrapper methods are deprecated and only standardized for compatibility purposes. For the case of `strike()`, the `<strike>` element itself has been removed from the HTML specification and shouldn't be used anymore. Web developers should use the `<del>` for deleted content or the `
` for content that is no longer accurate or no longer relevant instead.

Syntax
------


```js
strike()
```

### Parameters

None.

### Return value

A string beginning with a `<strike>` start tag, then the text `str`, and then a `</strike>` end tag.

Examples
--------

### Using strike()

The code below creates an HTML string and then replaces the document's body with it:


```js
const contentString = "Hello, world";

document.body.innerHTML = contentString.strike();
```


This will create the following HTML:


```html
<strike>Hello, world</strike>
```


**Warning:** This markup is invalid, because `strike` is no longer a valid element.

Instead of using `strike()` and creating HTML text directly, you should use DOM APIs such as `document.createElement()`. For example:


```js
const contentString = "Hello, world";
const elem = document.createElement("s");
elem.innerText = contentString;
document.body.appendChild(elem);
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.strike |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.strike` in `core-js`
* HTML wrapper methods
* `<strike>`
String.prototype.toLowerCase()
==============================

The **`toLowerCase()`** method of `String` values returns this string converted to lower case.

Try it
------

Syntax
------


```js
toLowerCase()
```

### Parameters

None.

### Return value

A new string representing the calling string converted to lower case.

Description
-----------

 The `toLowerCase()` method returns the value of the string converted to
 lower case. `toLowerCase()` does not affect the value of the string
 `str` itself.

Examples
--------

### Using `toLowerCase()`


```js
console.log("ALPHABET".toLowerCase()); // 'alphabet'
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.tolowercase |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `String.prototype.toLocaleLowerCase()`
* `String.prototype.toLocaleUpperCase()`
* `String.prototype.toUpperCase()`
String.prototype.bold()
=======================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`bold()`** method of `String` values creates a string that embeds this string in a `<b>` element (`<b>str</b>`), which causes this string to be displayed as bold.

**Note:** All HTML wrapper methods are deprecated and only standardized for compatibility purposes. Use DOM APIs such as `document.createElement()` instead.

Syntax
------


```js
bold()
```

### Parameters

None.

### Return value

A string beginning with a `<b>` start tag, then the text `str`, and then a `</b>` end tag.

Examples
--------

### Using bold()

The code below creates an HTML string and then replaces the document's body with it:


```js
const contentString = "Hello, world";

document.body.innerHTML = contentString.bold();
```


This will create the following HTML:


```html
<b>Hello, world</b>
```


Instead of using `bold()` and creating HTML text directly, you should use DOM APIs such as `document.createElement()`. For example:


```js
const contentString = "Hello, world";
const elem = document.createElement("b");
elem.innerText = contentString;
document.body.appendChild(elem);
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.bold |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.bold` in `core-js`
* HTML wrapper methods
* `<b>`
String.prototype.fontsize()
===========================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`fontsize()`** method of `String` values creates a string that embeds this string in a `<font>` element (`<font size="...">str</font>`), which causes this string to be displayed in the specified font size.

**Note:** All HTML wrapper methods are deprecated and only standardized for compatibility purposes. For the case of `fontsize()`, the `<font>` element itself has been removed from the HTML specification and shouldn't be used anymore. Web developers should use CSS properties instead.

Syntax
------


```js
fontsize(size)
```

### Parameters

`size`

An integer between 1 and 7, or a string representing a signed integer between 1 and 7.

### Return value

A string beginning with a `<font size="size">` start tag (double quotes in `size` are replaced with `&quot;`), then the text `str`, and then a `</font>` end tag.

Description
-----------

The `fontsize()` method itself simply joins the string parts together without any validation or normalization. However, to create valid `<font>` elements, When you specify size as an integer, you set the font size of `str` to one of the 7 defined sizes. You can specify `size` as a string such as `"-2"` or `"+3"` to adjust the font size of `str` relative to 3, the default value.

Examples
--------

### Using fontsize()

The code below creates an HTML string and then replaces the document's body with it:


```js
const contentString = "Hello, world";

document.body.innerHTML = contentString.fontsize(7);
```


This will create the following HTML:


```html
<font size="7">Hello, world</font>
```


**Warning:** This markup is invalid, because `font` is no longer a valid element.

Instead of using `fontsize()` and creating HTML text directly, you should use CSS to manipulate fonts. For example, you can manipulate `font-size` through the `element.style` attribute:


```js
document.getElementById("yourElemId").style.fontSize = "7pt";
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.fontsize |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.fontsize` in `core-js`
* HTML wrapper methods
* `<font>`
String.prototype.toString()
===========================

The **`toString()`** method of `String` values returns this string value.

Try it
------

Syntax
------


```js
toString()
```

### Parameters

None.

### Return value

A string representing the specified string value.

Description
-----------

 The `String` object overrides the `toString` method of `Object`; it does not inherit
 `Object.prototype.toString()`. For `String` values, the `toString` method returns the string itself (if it's a primitive) or the string that the `String` object wraps. It has the exact same implementation as `String.prototype.valueOf()`.

The `toString()` method requires its `this` value to be a `String` primitive or wrapper object. It throws a `TypeError` for other `this` values without attempting to coerce them to string values.

Because `String` doesn't have a `[@@toPrimitive]()` method, JavaScript calls the `toString()` method automatically when a `String` *object* is used in a context expecting a string, such as in a template literal. However, String *primitive* values do not consult the `toString()` method to be coerced to strings — since they are already strings, no conversion is performed.


```js
String.prototype.toString = () => "Overridden";
console.log(`${"foo"}`); // "foo"
console.log(`${new String("foo")}`); // "Overridden"
```

Examples
--------

### Using toString()

The following example displays the string value of a `String` object:


```js
const x = new String("Hello world");

console.log(x.toString()); // "Hello world"
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.tostring |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `String.prototype.valueOf()`
String.fromCodePoint()
======================

The **`String.fromCodePoint()`** static method returns a string created from the specified sequence of code points.

Try it
------

Syntax
------


```js
String.fromCodePoint()
String.fromCodePoint(num1)
String.fromCodePoint(num1, num2)
String.fromCodePoint(num1, num2, /\* …, \*/ numN)
```

### Parameters

`num1`, …, `numN`

An integer between `0` and `0x10FFFF` (inclusive) representing a Unicode code point.

### Return value

A string created by using the specified sequence of code points.

### Exceptions

`RangeError`

Thrown if `numN` is not an integer, is less than `0`, or is greater than `0x10FFFF` after being converted to a number.

Description
-----------

Because `fromCodePoint()` is a static method of `String`, you always use it as `String.fromCodePoint()`, rather than as a method of a `String` value you created.

Unicode code points range from `0` to `1114111` (`0x10FFFF`). In UTF-16, each string index is a code unit with value `0` – `65535`. Higher code points are represented by *a pair* of 16-bit surrogate pseudo-characters. Therefore, `fromCodePoint()` may return a string whose `length` (in UTF-16 code units) is larger than the number of arguments passed. For information on Unicode, see UTF-16 characters, Unicode code points, and grapheme clusters.

Examples
--------

### Using fromCodePoint()

Valid input:


```js
String.fromCodePoint(42); // "\*"
String.fromCodePoint(65, 90); // "AZ"
String.fromCodePoint(0x404); // "\u0404" === "Є"
String.fromCodePoint(0x2f804); // "\uD87E\uDC04"
String.fromCodePoint(194564); // "\uD87E\uDC04"
String.fromCodePoint(0x1d306, 0x61, 0x1d307); // "\uD834\uDF06a\uD834\uDF07"
```


Invalid input:


```js
String.fromCodePoint("\_"); // RangeError
String.fromCodePoint(Infinity); // RangeError
String.fromCodePoint(-1); // RangeError
String.fromCodePoint(3.14); // RangeError
String.fromCodePoint(3e-2); // RangeError
String.fromCodePoint(NaN); // RangeError
```

### Compared to fromCharCode()

`String.fromCharCode()` cannot return supplementary characters (i.e. code points `0x010000` – `0x10FFFF`) by specifying their code point. Instead, it requires the UTF-16 surrogate pair in order to return a supplementary character:


```js
String.fromCharCode(0xd83c, 0xdf03); // Code Point U+1F303 "Night with
String.fromCharCode(55356, 57091); // Stars" === "\uD83C\uDF03"
```


`String.fromCodePoint()`, on the other hand, can return 4-byte supplementary characters, as well as the more common 2-byte BMP characters, by specifying their code point (which is equivalent to the UTF-32 code unit):


```js
String.fromCodePoint(0x1f303); // or 127747 in decimal
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.fromcodepoint |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.fromCodePoint` in `core-js`
* `String.fromCharCode()`
* `String.prototype.charAt()`
* `String.prototype.codePointAt()`
* `String.prototype.charCodeAt()`
String.prototype.italics()
==========================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`italics()`** method of `String` values creates a string that embeds this string in an `<i>` element (`<i>str</i>`), which causes this string to be displayed as italic.

**Note:** All HTML wrapper methods are deprecated and only standardized for compatibility purposes. Use DOM APIs such as `document.createElement()` instead.

Syntax
------


```js
italics()
```

### Parameters

None.

### Return value

A string beginning with an `<i>` start tag, then the text `str`, and then an `</i>` end tag.

Examples
--------

### Using italics()

The code below creates an HTML string and then replaces the document's body with it:


```js
const contentString = "Hello, world";

document.body.innerHTML = contentString.italics();
```


This will create the following HTML:


```html
<i>Hello, world</i>
```


Instead of using `italics()` and creating HTML text directly, you should use DOM APIs such as `document.createElement()`. For example:


```js
const contentString = "Hello, world";
const elem = document.createElement("i");
elem.innerText = contentString;
document.body.appendChild(elem);
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.italics |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.italics` in `core-js`
* HTML wrapper methods
* `<i>`
String.prototype.concat()
=========================

 The **`concat()`** method of `String` values concatenates
 the string arguments to this string and returns a new string.

Try it
------

Syntax
------


```js
concat()
concat(str1)
concat(str1, str2)
concat(str1, str2, /\* …, \*/ strN)
```

### Parameters

`str1`, …, `strN`

One or more strings to concatenate to `str`.

### Return value

A new string containing the combined text of the strings provided.

Description
-----------

 The `concat()` function concatenates the string arguments to the calling
 string and returns a new string. Changes to the original string or the returned string
 don't affect the other.

 If the arguments are not of the type string, they are converted to string values before
 concatenating.

The `concat()` method is very similar to the addition/string concatenation operators (`+`, `+=`), except that `concat()` coerces its arguments directly to strings, while addition coerces its operands to primitives first. For more information, see the reference page for the `+` operator.

Examples
--------

### Using concat()

The following example combines strings into a new string.


```js
const hello = "Hello, ";
console.log(hello.concat("Kevin", ". Have a nice day."));
// Hello, Kevin. Have a nice day.

const greetList = ["Hello", " ", "Venkat", "!"];
"".concat(...greetList); // "Hello Venkat!"

"".concat({}); // "[object Object]"
"".concat([]); // ""
"".concat(null); // "null"
"".concat(true); // "true"
"".concat(4, 5); // "45"
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.concat |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Array.prototype.concat()`
* Addition (`+`)
String.prototype.endsWith()
===========================

The **`endsWith()`** method of `String` values determines whether a string ends with the characters of this string, returning `true` or `false` as appropriate.

Try it
------

Syntax
------


```js
endsWith(searchString)
endsWith(searchString, endPosition)
```

### Parameters

`searchString`

The characters to be searched for at the end of `str`. Cannot be a regex. All values that are not regexes are coerced to strings, so omitting it or passing `undefined` causes `endsWith()` to search for the string `"undefined"`, which is rarely what you want.

`endPosition` Optional

The end position at which `searchString` is expected to be found (the index of `searchString`'s last character plus 1). Defaults to `str.length`.

### Return value

**`true`** if the given characters are found at the end of the string, including when `searchString` is an empty string; otherwise, **`false`**.

### Exceptions

`TypeError`

Thrown if `searchString` is a regex.

Description
-----------

This method lets you determine whether or not a string ends with another string. This method is case-sensitive.

Examples
--------

### Using endsWith()


```js
const str = "To be, or not to be, that is the question.";

console.log(str.endsWith("question.")); // true
console.log(str.endsWith("to be")); // false
console.log(str.endsWith("to be", 19)); // true
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.endswith |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.endsWith` in `core-js`
* `String.prototype.startsWith()`
* `String.prototype.includes()`
* `String.prototype.indexOf()`
* `String.prototype.lastIndexOf()`
String.prototype.link()
=======================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The **`link()`** method of `String` values creates a string that embeds this string in an `<a>` element (`<a href="...">str</a>`), to be used as a hypertext link to another URL.

**Note:** All HTML wrapper methods are deprecated and only standardized for compatibility purposes. Use DOM APIs such as `document.createElement()` instead.

Syntax
------


```js
link(url)
```

### Parameters

`url`

Any string that specifies the `href` attribute of the `<a>` element; it should be a valid URL (relative or absolute), with any `&` characters escaped as `&amp;`.

### Return value

A string beginning with an `<a href="url">` start tag (double quotes in `url` are replaced with `&quot;`), then the text `str`, and then an `</a>` end tag.

Examples
--------

### Using link()

The code below creates an HTML string and then replaces the document's body with it:


```js
const contentString = "MDN Web Docs";

document.body.innerHTML = contentString.link("https://developer.mozilla.org/");
```


This will create the following HTML:


```html
<a href="https://developer.mozilla.org/">MDN Web Docs</a>
```


Instead of using `link()` and creating HTML text directly, you should use DOM APIs such as `document.createElement()`. For example:


```js
const contentString = "MDN Web Docs";
const elem = document.createElement("a");
elem.href = "https://developer.mozilla.org/";
elem.innerText = contentString;
document.body.appendChild(elem);
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-string.prototype.link |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `String.prototype.link` in `core-js`
* HTML wrapper methods
* `<a>`