aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin CHEN <33132228+KevinZonda@users.noreply.github.com>2021-06-16 20:01:15 +0100
committerIrvin <irvinfly@gmail.com>2021-06-18 01:45:01 +0800
commit8ae99e7af15133a7849e417ba2222033b5ab2e05 (patch)
treef789688d52645fa0eddf20ecf9cf0fee86c38fd6
parentfed8f903c0949ab8eaf52afd445f9f7821dd147b (diff)
downloadtranslated-content-8ae99e7af15133a7849e417ba2222033b5ab2e05.tar.gz
translated-content-8ae99e7af15133a7849e417ba2222033b5ab2e05.tar.bz2
translated-content-8ae99e7af15133a7849e417ba2222033b5ab2e05.zip
fix #516
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html15
1 files changed, 8 insertions, 7 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html
index df91848da8..c2f007e58a 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html
@@ -37,21 +37,22 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/isSealed
var empty = {};
Object.isSealed(empty); // === false
-// 如果你把一个空对象变的不可扩展,则它同时也会变成个密封对象.
+// 如果你把一个空对象变的不可扩展,则它同时也会变成个密封对象.
Object.preventExtensions(empty);
Object.isSealed(empty); // === true
-// 但如果这个对象不是空对象,则它不会变成密封对象,因为密封对象的所有自身属性必须是不可配置的.
+// 但如果这个对象不是空对象,则它不会变成密封对象,因为密封对象的所有自身属性必须是不可配置的.
var hasProp = { fee: "fie foe fum" };
Object.preventExtensions(hasProp);
Object.isSealed(hasProp); // === false
-// 如果把这个属性变的不可配置,则这个属性也就成了密封对象.
-Object.defineProperty(hasProp, "fee", { configurable: false });
-Object.isSealed(hasProp); // === false
-Object.isSealed(hasProp.fee); // === true
+// 如果把这个属性变的不可配置,则这个属性也就成了密封对象.
+Object.defineProperty(hasProp, 'fee', {
+ configurable: false
+});
+Object.isSealed(hasProp); // === true
-// 最简单的方法来生成一个密封对象,当然是使用Object.seal.
+// 最简单的方法来生成一个密封对象,当然是使用Object.seal.
var sealed = {};
Object.seal(sealed);
Object.isSealed(sealed); // === true