C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.split PropertyThe JavaScript Symbol.split symbol is used to split a string at the indices that match the regular expression. SyntaxSymbol.split(string) ParametersString Return valueA string that split from the given expression Browser Support
Example<script> //JavaScript to illustrate Symbol.split class Sp { constructor(value) { this.value = value; } [Symbol.split](string) { var index = string.indexOf(this.value); return this.value; } } document.write("We split point from the string JavaTpoint<br>") document.write('JavaTpoint'.split(new Sp('point'))); //expected output:We split point from the string JavaTpoint //point </script> Output: We split point from the string JavaTpoint point.
Next TopicJavaScript Symbol
|