Symbol.split
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
Die statische Dateneigenschaft Symbol.split
repräsentiert das wohlbekannte Symbol Symbol.split
. Die Methode String.prototype.split()
sucht in ihrem ersten Argument nach diesem Symbol für die Methode, die einen String an den Indizes aufteilt, die mit dem aktuellen Objekt übereinstimmen.
Für weitere Informationen siehe RegExp.prototype[Symbol.split]()
und String.prototype.split()
.
Probieren Sie es aus
Wert
Das wohlbekannte Symbol Symbol.split
.
Eigenschaften von Symbol.split | |
---|---|
Schreibbar | nein |
Aufzählbar | nein |
Konfigurierbar | nein |
Beispiele
Benutzerdefiniertes umgekehrtes Split
class ReverseSplit {
[Symbol.split](string) {
const array = string.split(" ");
return array.reverse();
}
}
console.log("Another one bites the dust".split(new ReverseSplit()));
// [ "dust", "the", "bites", "one", "Another" ]
Spezifikationen
Specification |
---|
ECMAScript® 2025 Language Specification # sec-symbol.split |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
split |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support