diff options
author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/uk/web/javascript/reference/global_objects/function/tostring | |
parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip |
remove retired locales (#699)
Diffstat (limited to 'files/uk/web/javascript/reference/global_objects/function/tostring')
-rw-r--r-- | files/uk/web/javascript/reference/global_objects/function/tostring/index.html | 233 |
1 files changed, 0 insertions, 233 deletions
diff --git a/files/uk/web/javascript/reference/global_objects/function/tostring/index.html b/files/uk/web/javascript/reference/global_objects/function/tostring/index.html deleted file mode 100644 index 5c4b58e347..0000000000 --- a/files/uk/web/javascript/reference/global_objects/function/tostring/index.html +++ /dev/null @@ -1,233 +0,0 @@ ---- -title: Function.prototype.toString() -slug: Web/JavaScript/Reference/Global_Objects/Function/toString -tags: - - Function - - JavaScript - - Prototype - - метод -translation_of: Web/JavaScript/Reference/Global_Objects/Function/toString ---- -<div>{{JSRef}}</div> - -<p>Метод <code><strong>toString()</strong></code> повертає рядкове представлення першокоду функції.</p> - -<div>{{EmbedInteractiveExample("pages/js/function-tostring.html")}}</div> - - - -<h2 id="Синтаксис">Синтаксис</h2> - -<pre class="syntaxbox"><code><var>function</var>.toString()</code></pre> - -<h3 id="Значення_що_повертається">Значення, що повертається</h3> - -<p>Рядкове представлення першокоду функції.</p> - -<h2 id="Опис">Опис</h2> - -<p>Об'єкт {{jsxref("Function")}} заміщує метод {{jsxref("Object.prototype.toString", "toString")}}, успадкований від {{jsxref("Object")}}; він не успадковує {{jsxref("Object.prototype.toString")}}. Для визначених користувачем об'єктів {{jsxref("Function")}} метод <code>toString</code> повертає рядок, який містить текстовий сегмент першокоду, що використовувався для визначення функції.</p> - -<p>JavaScript викликає метод <code>toString</code> автоматично, коли {{jsxref("Function")}} потрібно відобразити у вигляді текстового значення, наприклад, при поєднанні функції з рядком.</p> - -<p>Метод <code>toString()</code> викине виняток типу {{jsxref("TypeError")}} ("Function.prototype.toString called on incompatible object"), якщо його значення <code>this</code> не є об'єктом <code>Function</code>.</p> - -<pre class="brush: js example-bad">Function.prototype.toString.call('foo'); // TypeError -</pre> - -<p>Якщо метод <code>toString()</code> викликається на вбудованих функціональних об'єктах або функціях, створених <code>Function.prototype.bind</code>, <code>toString()</code> повертає <em>рядок нативної функції</em>, який виглядає так:</p> - -<pre class="brush: js">"function () {\n [native code]\n}" -</pre> - -<p>Якщо метод <code>toString()</code> викликається на функції, створеної конструктором <code>Function</code>, <code>toString()</code> повертає першокод синтезованої декларації функції, названої "anonymous", з наданими параметрами та тілом функції.</p> - -<h2 id="Приклади">Приклади</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Функція</th> - <th scope="col">Результат Function.prototype.toString</th> - </tr> - </thead> - <tbody> - <tr> - <td> - <pre> -function f(){}</pre> - </td> - <td> - <pre> -"function f(){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -class A { a(){} }</pre> - </td> - <td> - <pre> -"class A { a(){} }"</pre> - </td> - </tr> - <tr> - <td> - <pre> -function* g(){}</pre> - </td> - <td> - <pre> -"function* g(){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -a => a</pre> - </td> - <td> - <pre> -"a => a"</pre> - </td> - </tr> - <tr> - <td> - <pre> -({ a(){} }.a)</pre> - </td> - <td> - <pre> -"a(){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -({ *a(){} }.a)</pre> - </td> - <td> - <pre> -"*a(){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -({ [0](){} }[0])</pre> - </td> - <td> - <pre> -"[0](){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -Object.getOwnPropertyDescriptor({ - get a(){} -}, "a").get</pre> - </td> - <td> - <pre> -"get a(){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -Object.getOwnPropertyDescriptor({ - set a(x){} -}, "a").set</pre> - </td> - <td> - <pre> -"set a(x){}"</pre> - </td> - </tr> - <tr> - <td> - <pre> -Function.prototype.toString</pre> - </td> - <td> - <pre> -"function toString() { [native code] }"</pre> - </td> - </tr> - <tr> - <td> - <pre> -(function f(){}.bind(0))</pre> - </td> - <td> - <pre> -"function () { [native code] }"</pre> - </td> - </tr> - <tr> - <td> - <pre> -Function("a", "b")</pre> - </td> - <td> - <pre> -"function anonymous(a\n) {\nb\n}"</pre> - </td> - </tr> - </tbody> -</table> - -<h2 id="Специфікації">Специфікації</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Специфікації</th> - <th scope="col">Статус</th> - <th scope="col">Коментар</th> - </tr> - <tr> - <td>{{SpecName('ES1')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Початкове визначення. Реалізовано у JavaScript 1.1.</td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-function.prototype.tostring', 'Function.prototype.toString')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>Додані ще специфічні вимоги до рядкового представлення.</td> - </tr> - <tr> - <td><a href="https://tc39.github.io/Function-prototype-toString-revision/#sec-introduction"><code>Function.prototype.toString</code> revisions proposal</a></td> - <td>Чернетка</td> - <td>Стандартизує рядок нативної функції, закінчення рядків.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-function.prototype.tostring', 'Function.prototype.toString')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td></td> - </tr> - </tbody> -</table> - -<h2 id="Сумісність_з_веб-переглядачами">Сумісність з веб-переглядачами</h2> - -<div> - - -<p>{{Compat("javascript.builtins.Function.toString")}}</p> -</div> - -<h2 id="Примітки_щодо_Firefox">Примітки щодо Firefox</h2> - -<ul> - <li>Починаючи з Firefox 17, метод <code>Function.prototype.toString()</code> був реалізований зберіганням першокоду функції. Декомпілятор був прибраний, щоб параметр <code>indentation</code> більше не був потрібний. Більше інформації дивіться на сторінці {{bug("761723")}}.</li> - <li>Починаюи з Firefox 38 і до 63, метод <code>Function.prototype.toString()</code> викидав об'єкти {{jsxref("Proxy")}} ({{bug(1100936)}} та {{bug(1440468)}}).</li> -</ul> - -<h2 id="Див._також">Див. також</h2> - -<ul> - <li>{{jsxref("Object.prototype.toString()")}}</li> -</ul> |