The String.prototype property represents the String prototype object.
Property attributes of String.prototype
| |
|---|---|
| Writable | no |
| Enumerable | no |
| Configurable | no |
All String instances inherit from String.prototype. Changes to the String prototype object are propagated to all String instances.
String.prototype.constructorString.prototype.lengthNlength. These properties are read-only.String.prototype.charAt()String.prototype.charCodeAt()String.prototype.codePointAt()String.prototype.concat()String.prototype.includes()String.prototype.endsWith()String.prototype.indexOf()String object of the first occurrence of the specified value, or -1 if not found.String.prototype.lastIndexOf()String object of the last occurrence of the specified value, or -1 if not found.String.prototype.localeCompare()String.prototype.match()String.prototype.normalize()String.prototype.padEnd()String.prototype.padStart()String.prototype.quote() "").String.prototype.repeat()String.prototype.replace()String.prototype.search()String.prototype.slice()String.prototype.split()String object into an array of strings by separating the string into substrings.String.prototype.startsWith()String.prototype.substr()
String.prototype.substring()String.prototype.toLocaleLowerCase()toLowerCase().String.prototype.toLocaleUpperCase()toUpperCase().String.prototype.toLowerCase()String.prototype.toSource()
Object.prototype.toSource() method.String.prototype.toString()Object.prototype.toString() method.String.prototype.toUpperCase()String.prototype.trim()String.prototype.trimStart()String.prototype.trimLeft()
String.prototype.trimEnd()String.prototype.trimRight()
String.prototype.valueOf()Object.prototype.valueOf() method.String.prototype[@@iterator]()Iterator object that iterates over the code points of a String value, returning each code point as a String value.These methods are of limited use, as they provide only a subset of the available HTML tags and attributes.
String.prototype.anchor()
<a name="name"> (hypertext target)String.prototype.big()
<big>String.prototype.blink()
<blink>String.prototype.bold()
<b>String.prototype.fixed()
<tt>String.prototype.fontcolor()
<font color="color">String.prototype.fontsize()
<font size="size">String.prototype.italics()
<i>String.prototype.link()
<a href="url"> (link to URL)String.prototype.small()
<small>String.prototype.strike()
<strike>String.prototype.sub()
<sub>String.prototype.sup()
<sup>| Specification | Status | Comment |
|---|---|---|
| ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. |
| ECMAScript 5.1 (ECMA-262) The definition of 'String.prototype' in that specification. | Standard | |
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'String.prototype' in that specification. | Standard | |
| ECMAScript Latest Draft (ECMA-262) The definition of 'String.prototype' in that specification. | Draft |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | Yes | 1 | Yes | Yes | Yes |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 4 | Yes | Yes | Yes |
| Server | |
|---|---|
| Node.js | |
| Basic support | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype