String

This translation is incomplete. Please help translate this article from English

A String (karakterlánc, füzér) globális objektum egy konstruktor sztringek vagy karaktersorozatok számára.

Szintaxis

A sztringliterálok a következő formájúak:

'sztring szöveg'
"sztring szöveg"
"中文 español Deutsch English देवनागरी العربية português বাংলা русский 日本語 norsk bokmål ਪੰਜਾਬੀ 한국어 தமிழ் עברית"

Sztringeket létrehozhatunk a String globális objektummal közvetlenül:

String(dolog)

Paraméterek

thing
Bármi sztringgé alakítható.

Sablon literálok

Az ECMAScript 2015-tel kezdődően, a sztringliterálok ún. Template literal-ok is lehetnek:

`hello világ`
`hello!
 world!`
`hello ${who}`
tag `<a>${who}</a>`

Escape jelölés

Hagyományos, nyomtatható karakterek mellett, speciális karaktereket kódolhatunk az escape jelöléssel:

Kód Kimenet
\XXX oktális Latin-1 karakter.
\' egyszeres idézőjel
\" idézőjel
\\ backslash
\n új sor (soremelés)
\r kocsi-vissza
\v függőleges tabulátor
\t tabulátor
\b backspace
\f lapdobás
\uXXXX unicode kódpont
\u{X} ... \u{XXXXXX} unicode kódpont
\xXX hexadecimális Latin-1 karakter

Más nyelvekkel ellentétben a JavaScript nem különbözteti meg az egyszeres, illetve a kettős idézőjelekkel hivatkozott sztringeket; ezért a fenti escape szekvenciák mind az egyszeres, mind a kettős idézőjelekkel létrehozott sztringek esetén működnek.

Hosszú sztring literálok

Időnként a kódban szerepelhetnek nagyon hosszú sztringek. Vég nélkül folytatódó, illetve a szerkesztőprogram kénye-kedve szerint megtört sorok helyett lehetséges a sztringek több sorba tördelése a tartalom meghagyásával. Erre két mód van.

Használhatjuk a + operátort több füzér összefűzéséhez, így:

let longString = "Ez egy elég hosszú String ahhoz " +
                 "hogy több sorba rendezzem, mert " +
                 "máskülönben a kód nem olvasható.";

Vagy használható a backslash karakter ("\") az összes sor végén, jelölve, hogy a sztring a következő sorban folytatódik. Győződjünk meg róla, hogy nincs szóköz vagy más karakter a backslash után (soremelés kivételével), akár bekezdésként, különben nem fog működni. Ennek formája a kövekező:

let longString = "This is a very long string which needs \
to wrap across multiple lines because \
otherwise my code is unreadable.";

Mindkét forma a példában azonos sztringek létrehozását eredményezi.

Leírás

A stringek szöveges formában ábrázolt adatok tárolására használhatók. A leggyakoribb sztringműveletek közé tartozik a hossz vizsgálata, azok felépítése és összefűzése a + és += sztring operátorokkal, alfüzérek meglétének és helyének vizsgálata a indexOf() metódussal, illetve alfüzérek lekérdezése a substring() metódussal.

Karakter hozzáférés

Kétféle mód van egy sztringben az egyes karakterekhez vakó hozzáféréshez. Az egyik a charAt() metódus:

return 'macska'.charAt(1); // "a"-val tér vissza

A másik mód (bevezetve az ECMAScript 5-ben) tömbszerű objektumként kezeli a sztringet, ahol az egyes karaktereknem számindexek felelnek meg:

return 'macska'[1]; // "a"-val tér vissza

Törölni vagy megváltoztatni e tulajdonságokat karakter hozzáféréssel nem lehet a szögletes zárójeles jelölés esetén. A szóban forgó tulajdonságok nem írhatók és nem is konfigurálhatók. (Lásd a Object.defineProperty() cikket további információért.)

Sztringek összehasonlítása

C fejlesztőknek ismerős lehet a strcmp() függvény sztringek összehasonlításához. A JavaScript-ben a kisebb és nagyobb operátorok használhatók:

var a = 'a';
var b = 'b';
if (a < b) { // true
  console.log(a + ' kisebb, mint ' + b);
} else if (a > b) {
  console.log(a + ' nagyobb, mint ' + b);
} else {
  console.log(a + ' és ' + b + ' egyenlők.');
}

Hasonlót eredményez a localeCompare() metódus, amelyet a String példányok örökölnek.

Sztring primitívek és String objektumok megkülönböztetése

Jegyezzük meg, hogy a JavaScript különbséget tesz String objektumok és primitív sztring értékek között. (Ugyanez igaz Boolean és Number objektumokra.)

Sztringliterálok (egyszeri vagy kettős idézőjellel jelölve) és a String hívásából visszatérő, nem konstruktor kontextusból (azaz, nem a new kulcsszó használatával) kapott sztringek primitív sztringek. A JavaScript automatikusan String objektumokká alakítja a primitíveket, hogy eképpen a String objektum metódusai primitív sztringeken is használhatók legyenek. Amikor primitív sztringen hívódik metódus vagy tulajdonság lekérdezés, a JavaScript automatikusan becsomagolja a sztringet és így hívja meg a metódust, illetve a lekérdezést.

var s_prim = 'foo';
var s_obj = new String(s_prim);

console.log(typeof s_prim); // Konzol kimenet: "string"
console.log(typeof s_obj);  // Konzol kimenet: "object"

Sztring primitívek és String objektumok az eval() használatakor is különböző eredményt adnak. Az eval számára átadott primitívek forráskódként vannak kezelve, míg a String objektumok, mint bármely más átadott objektum esetén, az objektum visszaadását eredményezik. Például:

var s1 = '2 + 2';             // létrehoz egy sztring primitívet
var s2 = new String('2 + 2'); // létrehoz egy String objektumot
console.log(eval(s1));        // a 4 számmal tér vissza
console.log(eval(s2));        // a "2 + 2" sztringgel tér vissza

Ezen okok miatt a kód hibás működését okozhatja, amikor String objektumra fut, miközben primitív sztringet vár, bár általában nem szükséges a fejlesztőknek ezzel törődni.

Egy String objektum mindig átalakítható a primitív megfelelőjére a  valueOf() metódussal.

console.log(eval(s2.valueOf())); // 4-et ad vissza
Megjegyzés: Egy másik JavaScript-ben lehetséges megközelítésére a sztringeknek, lásd a StringView — a C-like representation of strings based on typed arrays cikket.

Tulajdonságok

String.prototype
Tulajdonságok hozzáadását engedélyezi egy String objektumhoz.

Metódusok

String.fromCharCode()
Unicode értékek meghatározott sorozatával megadott sztringgel tér vissza.
String.fromCodePoint()
Kódpontok meghatározott sorozatával megadott sztringgel tér vissza.
String.raw()
Nyers sablon sztring szerint létrehozott sztringgel tér vissza.

String generikus metódusok

A String generikusok nem szabványosak, elavultak és a közeljövőben törlésre kerülnek.

String példánymetódusok a JavaScript 1.6 óta elérhetők Firefox-ban (nem része az ECMAScript szabványnak) a String objektumon bármely objektumon String metódusok alkalmazására:

var num = 15;
console.log(String.replace(num, "5", "2"));

A String generikusokról való áttéréshez lásd a Warning: String.x is deprecated; use String.prototype.x instead cikket.

Tömbök generikusai (Generics) a tömb (Array) metódusokra is elérhetők.

String példányok

Tulajdonságok

Metódusok

HTML-hez nem kapcsolódó metódusok

String.prototype.charAt(index)
Returns the character (exactly one UTF-16 code unit) at the specified index.
String.prototype.charCodeAt(index)
Returns a number that is the UTF-16 code unit value at the given index.
String.prototype.codePointAt(pos)
Returns a nonnegative integer Number that is the code point value of the UTF-16 encoded code point starting at the specified pos.
String.prototype.concat(str [, ...strN ])
Combines the text of two (or more) strings and returns a new string.
String.prototype.includes(searchString [, position])
Determines whether the calling string contains searchString.
String.prototype.endsWith(searchString [, length])
Determines whether a string ends with the characters of the string searchString.
String.prototype.indexOf(searchValue [, fromIndex])
Returns the index within the calling String object of the first occurrence of searchValue, or -1 if not found.
String.prototype.lastIndexOf(searchValue [, fromIndex])
Returns the index within the calling String object of the last occurrence of searchValue, or -1 if not found.
String.prototype.localeCompare(compareString [, locales [, options]])
Returns a number indicating whether the reference string compareString comes before, after, or is equivalent to the given string in sort order.
String.prototype.match(regexp)
Used to match regular expression regexp against a string.
String.prototype.matchAll(regexp)
Returns an iterator of all regexp's matches.
String.prototype.normalize([form])
Returns the Unicode Normalization Form of the calling string value.
String.prototype.padEnd(targetLength [, padString])
Pads the current string from the end with a given string and returns a new string of the  length targetLength.
String.prototype.padStart(targetLength [, padString])
Pads the current string from the start with a given string and returns a new string of the length targetLength.
String.prototype.quote()
Wraps the string in double quotes (""").
String.prototype.repeat(count)
Returns a string consisting of the elements of the object repeated count times.
String.prototype.replace(searchFor, replaceWith)

Used to replace occurrences of searchFor using replaceWith.

searchFor may be a string or Regular Expression, and replaceWith may be a string or function.

String.prototype.search(regexp)
Search for a match between a regular expression regexp and the calling string.
String.prototype.slice(beginIndex[, endIndex])
Extracts a section of a string and returns a new string.
String.prototype.split([sep [, limit] ])
Returns an array of strings populated by splitting the calling string at occurences of the substring sep.
String.prototype.startsWith(searchString [, length])
Determines whether the calling string begins with the characters of string searchString.
String.prototype.substr()
Returns the characters in a string beginning at the specified location through the specified number of characters.
String.prototype.substring(indexStart [, indexEnd])
Returns a new string containing characters of the calling string from (or between) the specified index (or indeces).
String.prototype.toLocaleLowerCase( [locale, ...locales])

The characters within a string are converted to lowercase while respecting the current locale.

For most languages, this will return the same as toLowerCase().

String.prototype.toLocaleUpperCase( [locale, ...locales])

The characters within a string are converted to uppercase while respecting the current locale.

For most languages, this will return the same as toUpperCase().

String.prototype.toLowerCase()
Returns the calling string value converted to lowercase.
String.prototype.toSource()
Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource() method.
String.prototype.toString()
Returns a string representing the specified object. Overrides the Object.prototype.toString() method.
String.prototype.toUpperCase()
Returns the calling string value converted to uppercase.
String.prototype.trim()
Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.
String.prototype.trimStart()
String.prototype.trimLeft()
Trims whitespace from the beginning of the string.
String.prototype.trimEnd()
String.prototype.trimRight()
Trims whitespace from the end of the string.
String.prototype.valueOf()
Returns the primitive value of the specified object. Overrides the Object.prototype.valueOf() method.
String.prototype.@@iterator()
Returns a new Iterator object that iterates over the code points of a String value, returning each code point as a String value.

HTML wrapper methods

Példák

String konverzió

A String használható egy biztonságosabb toString() alternatívaként, mivel null, undefined, és symbol objektumokra is használható. Például:

var outputStrings = [];
for (var i = 0, n = inputValues.length; i < n; ++i) {
  outputStrings.push(String(inputValues[i]));
}

Specifikációk

Specificáció Státusz Megjegyzés
ECMAScript Latest Draft (ECMA-262)
The definition of 'String' in that specification.
Draft
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'String' in that specification.
Standard
ECMAScript 5.1 (ECMA-262)
The definition of 'String' in that specification.
Standard
ECMAScript 1st Edition (ECMA-262) Standard Kezdeti definíció.

Böngésző kompatibilitás

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
StringChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
anchor
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1
Notes
Full support 1
Notes
Notes Starting with version 17, the quotation mark (") is replaced by its HTML reference character (") in strings supplied for the name parameter.
IE No support NoOpera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
big
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
blink
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
bold
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
charAtChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
charCodeAtChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
codePointAtChrome Full support 41Edge Full support 12Firefox Full support 29IE No support NoOpera Full support 28Safari Full support 10WebView Android Full support YesChrome Android Full support 41Firefox Android Full support 29Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
concatChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
endsWithChrome Full support 41Edge Full support 12Firefox Full support 17IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support YesChrome Android Full support 36Firefox Android Full support 17Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
fixed
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
fontcolor
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
fontsize
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
fromCharCodeChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
fromCodePointChrome Full support 41Edge Full support 12Firefox Full support 29IE No support NoOpera Full support 28Safari Full support 10WebView Android Full support YesChrome Android Full support 41Firefox Android Full support 29Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
includesChrome Full support 41Edge Full support 12Firefox Full support 40
Full support 40
No support 18 — 48
Alternate Name
Alternate Name Uses the non-standard name: contains
IE No support NoOpera Full support YesSafari Full support 9WebView Android Full support YesChrome Android Full support 41Firefox Android Full support 40
Full support 40
No support 18 — 48
Alternate Name
Alternate Name Uses the non-standard name: contains
Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support Yesnodejs Full support 4.0.0
indexOfChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
italics
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
lastIndexOfChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 6Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
lengthChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
link
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
localeCompareChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 5.5Opera Full support YesSafari Full support 3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
localeCompare.localesChrome Full support 24Edge Full support 12Firefox Full support 29IE Full support 11Opera Full support 15Safari Full support 10WebView Android No support NoChrome Android Full support 26Firefox Android No support NoOpera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support 1.5nodejs ?
localeCompare.optionsChrome Full support 24Edge Full support 12Firefox Full support 29IE Full support 11Opera Full support 15Safari Full support 10WebView Android No support NoChrome Android Full support 26Firefox Android No support NoOpera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support 1.5nodejs ?
matchChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
match.flags
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 1 — 49IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support 4 — 49Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
matchAllChrome Full support 73Edge No support NoFirefox Full support 67IE No support NoOpera Full support 60Safari No support NoWebView Android Full support 73Chrome Android Full support 73Firefox Android Full support 67Opera Android Full support YesSafari iOS No support NoSamsung Internet Android No support Nonodejs Full support 12.0.0
normalizeChrome Full support 34Edge Full support 12Firefox Full support 31IE No support NoOpera Full support YesSafari Full support 10WebView Android No support NoChrome Android Full support 34Firefox Android Full support 31Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support 2.0nodejs Full support 0.12
padEndChrome Full support 57Edge Full support 15Firefox Full support 48IE No support NoOpera Full support 44Safari Full support 10WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 48Opera Android Full support 43Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs Full support 8.0.0
Full support 8.0.0
Full support 7.0.0
Disabled
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.
padStartChrome Full support 57Edge Full support 15Firefox Full support 48IE No support NoOpera Full support 44Safari Full support 10WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 48Opera Android Full support 43Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs Full support 8.0.0
Full support 8.0.0
Full support 7.0.0
Disabled
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.
prototypeChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
quote
Deprecated
Chrome No support NoEdge No support NoFirefox No support 1 — 37IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support 4 — 37Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
rawChrome Full support 41Edge Full support 12Firefox Full support 34IE No support NoOpera No support NoSafari Full support 10WebView Android No support NoChrome Android Full support 41Firefox Android Full support 34Opera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support 4.0nodejs Full support 4.0.0
repeatChrome Full support 41Edge Full support 12Firefox Full support 24IE No support NoOpera Full support YesSafari Full support 9WebView Android No support NoChrome Android Full support 36Firefox Android Full support 24Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
replaceChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
replace.flags
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 1 — 49IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support 4 — 49Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
searchChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
search.flags
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 1 — 49IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support 4 — 49Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
sliceChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
small
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
splitChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
startsWithChrome Full support 41Edge Full support 12Firefox Full support 17IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support YesChrome Android Full support 36Firefox Android Full support 17Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
strike
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
sub
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
substr
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
substringChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
sup
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
toLocaleLowerCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 5.5Opera Full support YesSafari Full support 1.3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
toLocaleLowerCase.localeChrome Full support 58Edge Full support 12Firefox Full support 55IE Full support 6Opera Full support 45Safari Full support 10WebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 55Opera Android Full support 43Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs ?
toLocaleUpperCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 5.5Opera Full support YesSafari Full support 1.3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
toLocaleUpperCase.localeChrome Full support 58Edge Full support 12Firefox Full support 55IE Full support 6Opera Full support 45Safari Full support 10WebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 55Opera Android Full support 42Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs ?
toLowerCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
toSource
Non-standard
Chrome No support NoEdge No support NoFirefox Full support 1IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
toStringChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
toUpperCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
trimChrome Full support 4Edge Full support 12Firefox Full support 3.5IE Full support 9Opera Full support 10.5Safari Full support 5WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 11Safari iOS Full support YesSamsung Internet Android Full support 1.0nodejs Full support Yes
trimEndChrome Full support 66
Full support 66
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Edge Full support 12
Alternate Name
Full support 12
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Firefox Full support 61
Full support 61
Full support 3.5
Alternate Name
Alternate Name Uses the non-standard name: trimRight
IE No support NoOpera Full support 53
Full support 53
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Safari Full support 12WebView Android Full support 66
Full support 66
Full support ≤37
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Chrome Android Full support 66
Full support 66
Full support 18
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Firefox Android Full support 61
Full support 61
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Opera Android Full support 47
Full support 47
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Safari iOS Full support 12Samsung Internet Android Full support 9.0
Full support 9.0
Full support 1.0
Alternate Name
Alternate Name Uses the non-standard name: trimRight
nodejs Full support 10.0.0
Full support 10.0.0
Full support 0.12
Alternate Name
Alternate Name Uses the non-standard name: trimRight
trimStartChrome Full support 66
Full support 66
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Edge Full support 12
Alternate Name
Full support 12
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Firefox Full support 61
Full support 61
Full support 3.5
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
IE No support NoOpera Full support 53
Full support 53
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Safari Full support 12WebView Android Full support 66
Full support 66
Full support ≤37
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Chrome Android Full support 66
Full support 66
Full support 18
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Firefox Android Full support 61
Full support 61
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Opera Android Full support 47
Full support 47
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Safari iOS Full support 12Samsung Internet Android Full support 9.0
Full support 9.0
Full support 1.0
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
nodejs Full support 10.0.0
Full support 10.0.0
Full support 0.12
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Unicode code point escapes \u{xxxxxx}Chrome Full support 1Edge Full support 12Firefox Full support 40IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 40Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
valueOfChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support Yes
@@iteratorChrome Full support 38Edge Full support 12Firefox Full support 36
Full support 36
No support 27 — 36
Notes Alternate Name
Notes A placeholder property named @@iterator is used.
Alternate Name Uses the non-standard name: @@iterator
No support 17 — 27
Notes Alternate Name
Notes A placeholder property named iterator is used.
Alternate Name Uses the non-standard name: iterator
IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 36
Full support 36
No support 27 — 36
Notes Alternate Name
Notes A placeholder property named @@iterator is used.
Alternate Name Uses the non-standard name: @@iterator
No support 17 — 27
Notes Alternate Name
Notes A placeholder property named iterator is used.
Alternate Name Uses the non-standard name: iterator
Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0nodejs Full support 0.12

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.

Lásd még