1  Object.seal(O)的调用

When the seal function is called, the following steps are taken:
   If Type(O) is not Object throw a TypeError exception.
   For each named own property name P of O,
      Let desc be the result of calling the [[GetOwnProperty]] internal method of O with P.
      If desc.[[Configurable]] is true, set desc.[[Configurable]] to false.
      Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments.
   Set the [[Extensible]] internal property of O to false.
  Return O.

2 Object.freeze(O)的调用

  If Type(O) is not Object throw a TypeError exception.
  For each named own property name P of O,
    Let desc be the result of calling the [[GetOwnProperty]] internal method of O with P.
    If IsDataDescriptor(desc) is true, then
      If desc.[[Writable]] is true, set desc.[[Writable]] to false.
      If desc.[[Configurable]] is true, set desc.[[Configurable]] to false.
    Call the [[DefineOwnProperty]] internal method of O with P, desc, and true as arguments.
    Set the [[Extensible]] internal property of O to false.
   Return O.

这两个函数的区别在于伪代码标记部分,这下是终于搞定这两个函数的区别了。

ECMA5.1中Object.seal()和Object.freeze()的区别的更多相关文章

  1. js中的Object.seal()与Object.freeze()

    关键字:seal, freeze, property descriptor. 1.Object.seal() 参考文档(2)中这样描述: The Object.seal() method seals ...

  2. ES5 对象的扩展(Object.preventExtensions)、密封(Object.seal)和冻结(Object.freeze)

    前面提到 ES5 对象属性描述符,这篇看看对象的扩展.密封和冻结. 扩展对象 Object.preventExtensions Object.isExtensible 密封对象 Object.seal ...

  3. Object.defineProperty和Object.freeze、Object.seal

    目录 一 Object.defineProperty 1.1 用法 1.2 数据描述 1.2.1 value 1.2.2 writable 1.2.3 enumerable 1.2.4 configu ...

  4. [Javascript] Object.freeze() vs Object.seal()

    let person = { firstName: "Zhentian", lastName: "Wan" }; /*Object.freeze() makes ...

  5. Object.freeze与 Object.seal的区别

    Object.freeze()冻结一个对象.不能添加新的属性,不能删除已有属性,不能修改该对象已有属性的可枚举性.可配置性.可写性,以及不能修改已有属性的值.冻结一个对象后该对象的原型也不能被修改. ...

  6. JavaScript中你所不知道的Object(一)

    Object实在是JavaScript中很基础的东西了,在工作中,它只有那么贫瘠的几个用法,让人感觉不过尔尔,但是我们真的了解它吗? 1. 当我们习惯用 var a = { name: 'tarol' ...

  7. JS 中 原生方法 (四) --- Object

    Javascript 中 str. arr.date.obj 等常见的原生方法总结 本文也说主要阐释了 Javascript 中的基础类型和 引用类型的自带方法,那么熟悉的同学又可以绕道了 总是绕道, ...

  8. javascript中的Function和Object

    写的很好,理解了很多,特此转发记录 转自:http://blog.csdn.net/tom_221x/archive/2010/02/22/5316675.aspx 在JavaScript中所有的对象 ...

  9. ES5特性Object.seal

    一个对象在默认状态下: 1,extensible:可扩展(可以添加新的属性) 2,configurable:可配置(可以改变原有属性的特性,比如修改属性的enumerable) Object.seal ...

随机推荐

  1. Topology拓扑

  2. NTC(负温度)热敏电阻.阻值的计算方式

    来源 :http://blog.csdn.net/blue0432/article/details/8690190 现在低成本测温方案中NTC热敏电阻用的比较多,一般采用查表的方法获取温度值,这就牵涉 ...

  3. 基于Cloudera Manager5配置HIVE压缩

    [Author]: kwu 基于Cloudera Manager5配置HIVE压缩,配置HIVE的压缩.实际就是配置MapReduce的压缩,包含执行结果及中间结果的压缩. 1.基于HIVE命令行的配 ...

  4. OpenOffice的安装与启动2

    1.tar -zxvfApache_OpenOffice_4.1.0_Linux_x86-64_install-rpm_zh-CN.tar.gz  2.cd zh-CN  3.rpm -Uvh RPM ...

  5. windows下载安装MariaDB5.5.32 绿色版

    1.下载地址: http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/mariadb-5.5.32/win32-packages/mariadb-5.5.32 ...

  6. android114 c转换成c++

    ##C向C++改造 . 把c文件后缀名换成cpp . Android.mk文件中的hello.c也要换成hello.cpp . c++的使用的环境变量结构体中,访问了c使用的结构体的函数指针,函数名全 ...

  7. 实现类似shared_ptr的引用计数

    13.27 定义使用引用计数版本的HasPtr #include<iostream> #include<string> #include<new> using na ...

  8. CLOSE_WAIT状态的原因与解决方法 --转

    转自:http://blog.chinaunix.net/uid-20357359-id-1963662.html 这个问题之前没有怎么留意过,是最近在面试过程中遇到的一个问题,面了两家公司,两家公司 ...

  9. RPM vs SRPM

    RPM 全名是『 RedHat Package Manager 』简称则为 RPM 啦!顾名思义,当初这个软件管理的机制是由 Red Hat 这家公司发展出来的. RPM 是以一种数据库记录的方式来将 ...

  10. FileFilter, FilenameFilter用法和文件排序

    FileFilter和FilenameFilter这两个类的用法都很简单,都只有一个方法 FileFilter /*** @param pathname The abstract pathname t ...