aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/javascript/reference/global_objects/object/isextensible
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/javascript/reference/global_objects/object/isextensible
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/web/javascript/reference/global_objects/object/isextensible')
-rw-r--r--files/ru/web/javascript/reference/global_objects/object/isextensible/index.html134
1 files changed, 134 insertions, 0 deletions
diff --git a/files/ru/web/javascript/reference/global_objects/object/isextensible/index.html b/files/ru/web/javascript/reference/global_objects/object/isextensible/index.html
new file mode 100644
index 0000000000..99b44f9654
--- /dev/null
+++ b/files/ru/web/javascript/reference/global_objects/object/isextensible/index.html
@@ -0,0 +1,134 @@
+---
+title: Object.isExtensible()
+slug: Web/JavaScript/Reference/Global_Objects/Object/isExtensible
+tags:
+ - ECMAScript5
+ - JavaScript
+ - JavaScript 1.8.5
+ - Method
+ - Object
+translation_of: Web/JavaScript/Reference/Global_Objects/Object/isExtensible
+---
+<div>{{JSRef("Global_Objects", "Object")}}</div>
+
+<h2 id="Summary" name="Summary">Сводка</h2>
+<p>Метод <strong><code>Object.isExtensible()</code></strong> определяет, является ли объект расширяемым (то есть, можно ли к нему добавлять новые свойства).</p>
+
+<h2 id="Syntax" name="Syntax">Синтаксис</h2>
+<pre class="syntaxbox"><code>Object.isExtensible(<var>obj</var>)</code></pre>
+
+<h3 id="Parameters" name="Parameters">Параметры</h3>
+<dl>
+ <dt><code>obj</code></dt>
+ <dd>Проверяемый объект.</dd>
+</dl>
+
+<h2 id="Description" name="Description">Описание</h2>
+<p>Объекты являются расширяемыми по умолчанию: к ним можно добавлять новые свойства и (в движках, поддерживающих свойство {{jsxref("Object.proto", "__proto__")}}) их можно изменять. Объект может быть помечен, как не изменяемый с помощью методов {{jsxref("Object.preventExtensions()")}}, {{jsxref("Object.seal()")}} или {{jsxref("Object.freeze()")}}.</p>
+
+<h2 id="Examples" name="Examples">Примеры</h2>
+<pre class="brush: js">// Новые объекты являются расширяемыми.
+var empty = {};
+assert(Object.isExtensible(empty) === true);
+
+// ...но это может быть изменено.
+Object.preventExtensions(empty);
+assert(Object.isExtensible(empty) === false);
+
+// Запечатанные объекты по определению не расширяемы.
+var sealed = Object.seal({});
+assert(Object.isExtensible(sealed) === false);
+
+// Замороженные объекты также по определению не расширяемы.
+var frozen = Object.freeze({});
+assert(Object.isExtensible(frozen) === false);
+</pre>
+
+<h2 id="Notes" name="Notes">Примечания</h2>
+<p>В ES5, если аргумент метода не является объектом (является примитивным значением), будет выброшено исключение {{jsxref("Global_Objects/TypeError", "TypeError")}}. В ES6 такой аргумент будет рассматриваться, как простой не расширяемый объект и метод просто вернёт <code>false</code>.</p>
+<pre class="brush: js">&gt; Object.isExtensible(1)
+TypeError: 1 is not an object // код ES5
+
+&gt; Object.isExtensible(1)
+false // код ES6
+</pre>
+
+<h2 id="Specifications" name="Specifications">Спецификации</h2>
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Спецификация</th>
+ <th scope="col">Статус</th>
+ <th scope="col">Комментарии</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.3.13', 'Object.isExtensible')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td>Изначальное определение. Реализована в JavaScript 1.8.5.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.isextensible', 'Object.isExtensible')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">Совместимость с браузерами</h2>
+<div>{{CompatibilityTable}}</div>
+<div id="compat-desktop">
+ <table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Возможность</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Базовая поддержка</td>
+ <td>{{CompatChrome("6")}}</td>
+ <td>{{CompatGeckoDesktop("2.0")}}</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatOpera("12")}}</td>
+ <td>{{CompatSafari("5.1")}}</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+<div id="compat-mobile">
+ <table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Возможность</th>
+ <th>Android</th>
+ <th>Chrome для Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Базовая поддержка</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+<p>На основе <a class="external" href="http://kangax.github.com/es5-compat-table/">таблицы совместимости Kangax</a>.</p>
+
+<h2 id="See_also" name="See_also">Смотрите также</h2>
+<ul>
+ <li>{{jsxref("Object.preventExtensions()")}}</li>
+ <li>{{jsxref("Object.seal()")}}</li>
+ <li>{{jsxref("Object.isSealed()")}}</li>
+ <li>{{jsxref("Object.freeze()")}}</li>
+ <li>{{jsxref("Object.isFrozen()")}}</li>
+</ul>