diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
commit | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch) | |
tree | a9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/uk/web/javascript/reference/global_objects/symbol/split | |
parent | 074785cea106179cb3305637055ab0a009ca74f2 (diff) | |
download | translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2 translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip |
initial commit
Diffstat (limited to 'files/uk/web/javascript/reference/global_objects/symbol/split')
-rw-r--r-- | files/uk/web/javascript/reference/global_objects/symbol/split/index.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/files/uk/web/javascript/reference/global_objects/symbol/split/index.html b/files/uk/web/javascript/reference/global_objects/symbol/split/index.html new file mode 100644 index 0000000000..baabe4748f --- /dev/null +++ b/files/uk/web/javascript/reference/global_objects/symbol/split/index.html @@ -0,0 +1,66 @@ +--- +title: Symbol.split +slug: Web/JavaScript/Reference/Global_Objects/Symbol/split +tags: + - ECMAScript 2015 + - JavaScript + - Symbol + - Властивість + - Символ +translation_of: Web/JavaScript/Reference/Global_Objects/Symbol/split +--- +<div>{{JSRef}}</div> + +<p>Добревідомий символ <code><strong>Symbol.split</strong></code> визначає метод, що розбиває рядок за індексами, які збігаються з регулярним виразом. Ця функція викликається методом {{jsxref("String.prototype.split()")}}.</p> + +<p>Щоб дізнатись більше, дивіться {{jsxref("RegExp.@@split", "RegExp.prototype[@@split]()")}} та {{jsxref("String.prototype.split()")}}.</p> + +<div>{{EmbedInteractiveExample("pages/js/symbol-split.html")}}</div> + +<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div> + +<div>{{js_property_attributes(0,0,0)}}</div> + +<h2 id="Приклади">Приклади</h2> + +<h3 id="Користувацьке_розбиття_з_переверненням">Користувацьке розбиття з переверненням</h3> + +<pre class="brush: js notranslate">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" ]</pre> + +<h2 id="Специфікації">Специфікації</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Специфікація</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('ESDraft', '#sec-symbol.split', 'Symbol.split')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Сумісність_з_веб-переглядачами">Сумісність з веб-переглядачами</h2> + + + +<p>{{Compat("javascript.builtins.Symbol.split")}}</p> + +<h2 id="Див._також">Див. також</h2> + +<ul> + <li>{{jsxref("Symbol.match")}}</li> + <li>{{jsxref("Symbol.replace")}}</li> + <li>{{jsxref("Symbol.search")}}</li> + <li>{{jsxref("RegExp.@@split", "RegExp.prototype[@@split]()")}}</li> +</ul> |