[link to URL]
String.prototype.small[]
Deprecated
String.prototype.strike[]
Deprecated
String.prototype.sub[]
Deprecated
String.prototype.sup[]
Deprecated
Note that these methods do not check if the string itself contains HTML tags, so it's possible to create invalid HTML:
"".bold[]; //
The only escaping they do is to replace "
in the attribute value [for anchor[]
, fontcolor[]
,
fontsize[]
, and link[]
] with "
.
"foo".anchor['"Hello"']; // foo
Examples
String conversion
It's possible to use String
as a more
reliable toString[]
alternative, as it works when used on null
and undefined
. For example:
const nullVar = null;
nullVar.toString[]; // TypeError: nullVar is null
String[nullVar]; // "null"
const undefinedVar = undefined;
undefinedVar.toString[]; // TypeError: undefinedVar is undefined
String[undefinedVar]; // "undefined"
Specifications
ECMAScript Language Specification # sec-string-objects |
Browser compatibility
BCD tables only load in the browser