mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-15 15:20:30 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<h2 id="Summary" name="Summary">概述</h2>
|
||||
<p><code><strong>Object.isExtensible()</strong></code> 方法判断一个对象是否是可扩展的(是否可以在它上面添加新的属性)。</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code>Object.isExtensible(<em>obj</em>)</code></pre>
|
||||
<pre><code class="language-javascript"><code>Object.isExtensible(<em>obj</em>)</code></code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<dl>
|
||||
<dt>obj</dt>
|
||||
@@ -14,7 +14,7 @@
|
||||
<h2 id="Description" name="Description">描述</h2>
|
||||
<p>默认情况下,对象是可扩展的:即可以为他们添加新的属性。以及它们的 <a href="Reference/Global_Objects/Object/proto" title="使用__proto__是有争议的,也不鼓励使用它。因为它从来没有被包括在EcmaScript语言规范中,但是现代浏览器都实现了它。__proto__属性已在ECMAScript 6语言规范中标准化,用于确保Web浏览器的兼容性,因此它未来将被支持。它已被不推荐使用, 现在更推荐使用Object.getPrototypeOf/Reflect.getPrototypeOf 和Object.setPrototypeOf/Reflect.setPrototypeOf(尽管如此,设置对象的[[Prototype]]是一个缓慢的操作,如果性能是一个问题,应该避免)。"><code>__proto__</code></a><span title="This deprecated API should no longer be used, but will probably still work."><i class="icon-thumbs-down-alt"> </i></span> 属性可以被更改。<a href="Reference/Global_Objects/Object/preventExtensions" title="Object.preventExtensions()方法让一个对象变的不可扩展,也就是永远不能再添加新的属性。"><code>Object.preventExtensions</code></a>,<a href="Reference/Global_Objects/Object/seal" title="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 https://github.com/mdn/interactive-examples and send us a pull request."><code>Object.seal</code></a> 或 <a href="Reference/Global_Objects/Object/freeze" title="Object.freeze() 方法可以冻结一个对象。一个被冻结的对象再也不能被修改;冻结了一个对象则不能向这个对象添加新的属性,不能删除已有属性,不能修改该对象已有属性的可枚举性、可配置性、可写性,以及不能修改已有属性的值。此外,冻结一个对象后该对象的原型也不能被修改。freeze() 返回和传入的参数相同的对象。"><code>Object.freeze</code></a> 方法都可以标记一个对象为不可扩展(non-extensible)。</p>
|
||||
<h2 id="Examples" name="Examples">例子</h2>
|
||||
<pre class="brush: js">// 新对象默认是可扩展的.
|
||||
<pre><code class="language-javascript">// 新对象默认是可扩展的.
|
||||
var empty = {};
|
||||
Object.isExtensible(empty); // === true
|
||||
|
||||
@@ -29,7 +29,7 @@ Object.isExtensible(sealed); // === false
|
||||
// 冻结对象也是不可扩展.
|
||||
var frozen = Object.freeze({});
|
||||
Object.isExtensible(frozen); // === false
|
||||
</pre>
|
||||
</code></pre>
|
||||
<p> </p>
|
||||
<h2 id="注意" style="margin-bottom: 20px; line-height: 30px;">注意</h2>
|
||||
<p>在 ES5 中,如果参数不是一个对象类型,将抛出一个 <a href="Reference/Global_Objects/TypeError" title="TypeError(类型错误) 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a> 异常。在 ES6 中, non-object 参数将被视为一个不可扩展的普通对象,因此会返回 false 。</p>
|
||||
@@ -38,7 +38,7 @@ Object.isExtensible(frozen); // === false
|
||||
|
||||
Object.isExtensible(1);
|
||||
// false (ES6 code)
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user