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. Import the Add Email and Post Configuration to the SiteMap managed solution -Dynamices CRM

    We have prepared a managed solution named Add Email and Post Configuration to SiteMap that you can i ...

  2. IT应聘者的简历应该是怎么样的?

    从去年到现在看了几百份简历,包括产品运营和产品设计师的职位.我不是 HR,只是想直接看到求职者的状况,看看是不是要换更准确的渠道去招聘对的人.我看简历的目的也很简单:找到没有什么问题且可能合适的人,然 ...

  3. 关于学习Scala语言的一些感悟

    进入话题! 我们知道哈,Spark源码采用Scala语言编写,那么阅读Spark源码之前,是否一定先学Scala呢? 我个人认为,不必,只要我们有一些java或c++编写语言的基础,就可以看Spaar ...

  4. PC-大概最全的黑客工具表了

    纯真IP数据库查询程序 ­ remote administrator ­ (rar解密)ZiperelloV2.0 汉化版.zip ­ (代理跳板)SkSockServer1.09.zip ­ [ar ...

  5. JAVA_3lesson

    程序设计守则 为了增加程序的可扩展性,维护性.可以采用interface, abstract   可以抽象出来:共同的方法,属性   开发系统时,主体构架使用接口,接口构成了系统的骨架.   要遵循开 ...

  6. (一)Redis初学教程之安装篇

    1.下载windows下Redis服务安装程序(有32位的和64位的,识操作系统安装) 下载地址:https://github.com/dmajkic/redis/downloads 2.安装教程(详 ...

  7. scala编程笔记(三)类,字段和方法

    类,字段和方法 类是对象的蓝图,能够通过new来创建对象.在类的定义里能够有字段和方法.统称member val还是var都是指向对象的变量(var定义的字段可又一次赋值),def定义方法,包括可运行 ...

  8. SecureCRT学习之道:SecureCRT经常使用快捷键设置与字体设置方法

    1:假设不想每次登陆都输入password,能够在你打开的session里邮件session option->login action 选中automate logon 双击ogin 和assw ...

  9. [Whole Web] [AngularJS + Grunt] Using ng-html2js to Convert Templates into JavaScript

    ng-html2js takes .html templates and converts them into strings stored in AngularJS's template cache ...

  10. 【转】GitHub删除一个仓库——2013-08-27 21

    http://xiacijian.blog.163.com/blog/static/849931902012111195041170/ 1.进入要删除的仓库 2.找到 导航栏 Code  NetWor ...