Variables As Properties

When you declare a global JavaScript variable, what you are actually doing is defining a property of the global object . If you use var to declare the variable, the

当你声明一个全局变量,实际上,你是给全局对象定义了一个属性。如果你是用 var 声明的变量,

property that is created is nonconfigurable , which means that it cannot be deleted with the delete operator. We’ve already noted that if you’re not using strict mode

所创建的属性是不可配置的,也就是说不能用 delete 操作符 从全局对象中删除掉。在非严格模式下,

and you assign a value to an undeclared variable, JavaScript automatically creates a global variable for you.

给一个尚未声明的变量赋值,JS 会自动创建一个全局变量。

JavaScript global variables are properties of the global object, and this is mandated by the ECMAScript specification. There is no such requirement for local variables,

JS全局变量就是全局对象的属性,这是ECMAScript 规定的。局部变量虽然没有这样的规定,

but you can imagine local variables as the properties of an object associated with each function invocation. The ECMAScript 3 specification referred to this object as

但是局部变量是 函数调时创建的关联对象 的属性,ECMAScript 3 把这个 关联对象叫做 “call object”,

the“call object,” and the ECMAScript 5 specification calls it a “declarative environment record.” JavaScript allows us to refer to the global object with the this keyword,

而 ECMAScript 5  把这个关联对象叫做 “声明环境记录”。JS 允许我们通过  this 关键字 来应用全局对象,

but it does not give us any way to refer to the object in which local variables are stored. The precise nature of these objects that hold local variables is an

但是,没有任何办法去引用这个 调用时创建 的关联对象。实现这个关联对象具体细节,不用我们去关心,

implementation detail that need not concern us. The notion that these local variable objects exist, however, is an important one.

但是,重要的是,要知道有这样的一个关联对象存在。

JS -- Variables As Properties的更多相关文章

  1. [Vue] Use Vue.js Component Computed Properties

    You can add computed properties to a component to calculate a property on the fly. The benefit of th ...

  2. jquery.i18n.properties.js hacking

    /****************************************************************************** * jquery.i18n.proper ...

  3. 分别用Java和JS读取Properties文件内容

    项目中经常用到的配置文件,除了XML文件之外,还会用到Properties文件来存储一些信息,例如国际化的设置.jdbc连接信息的配置等.有时候也会把一些路径或者sql语句放到Properties中, ...

  4. JS -- The Scope Chain 作用域链

    The Scope Chain JavaScript is a lexically scoped language: the scope of a variable can be thought of ...

  5. 基于jQuery.i18n.properties实现前端网站语言多版本

    我是参考播客做了个demo:http://blog.csdn.net/aixiaoyang168/article/details/49336709 jQuery.i18n.properties采用.p ...

  6. 使用 pdf.js 查看发票时,显示不了台头和印章的解决办法

    系统中使用了 pdf.js 来查看 PDF 文件,发现在查看 电子发票时, 缺失了很多信息, 刚开始以为是 PDF.JS 的 BUG, 后来调试发现只需要在 IIS 里添加一个 bcmap 后缀的 m ...

  7. 纯js国际化(i18n)

    i18n,是internationalization单词的简写,中间18个字符略去,简称i18n,意图就是实现国际化,方便产品在不同的场景下使用 目标:可以点击切换语言或者ChangeLanguage ...

  8. 解决前端js、css缓存问题

    去js标签库查询jquery.i18n.properties.js这个js引用到页面上: 新建一个配置文件:用上面的那个js方法调取配置文件里的版本号给其他的js加上: 示例: <script ...

  9. A Study of WebRTC Security

    转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...

随机推荐

  1. C# 根据Excel模版导出文件

    string fileName = Path.Combine(Application.StartupPath, "kfwh_yhxf.xls"); Microsoft.Office ...

  2. 国内5家云服务厂商 HTTPS 安全性测试横向对比

    随着 Chrome.Firefox 等浏览器对 HTTPS 的重视,国内众多云服务厂商都相继提供 SSL 证书申购服务,但是大家有没有注意到一个细节,不同厂家申请的 SSL 证书,由于证书性能.功能差 ...

  3. appium 判断app是否安装

    #coding:utf-8 #Import the common package import os import unittest from appium import webdriver from ...

  4. ASP.NET Core的身份认证框架IdentityServer4(7)- 使用客户端证书控制API访问

    前言 今天(2017-9-8,写于9.8,今天才发布)一口气连续把最后几篇IdentityServer4相关理论全部翻译完了,终于可以进入写代码的过程了,比较累.目前官方的文档和Demo以及一些相关组 ...

  5. Android基础知识大全(精品)

    [1].ProgressBar   <ProgressBar android:id="@+id/progress_bar" android:layout_width=&quo ...

  6. Unity3D安装破解教程(以Unity5.3.4为例)(转)

      Unity3D是由Unity Technologies开发的一个让玩家轻松创建诸如三维视频游戏.建筑可视化.实时三维动画等类型互动内容的多平台的综合型游戏开发工具,是一个全面整合的专业游戏引擎.目 ...

  7. mysql时间戳的获取

    时间戳函数:current_timestamp() 在此位置添加时间戳函数. 然后整体的写法就是下图这样: 根据当前时间戳更新有没有打钩将决定你的时间是什么时间(一个是数据完成写入的时间,一个时间戳回 ...

  8. 201521123055 《Java程序设计》第8周学习总结

    1. 本章学习总结 2. 书面作业 Q1.List中指定元素的删除(题目4-1) public static List<String> convertStringToList(String ...

  9. Java课程设计——学生成绩管理系统(201521123003 董美凤)

    Java课程设计--学生成绩管理系统(201521123003 董美凤) 1.团队课程设计博客链接 学生成绩管理系统博客链接 2.个人负责模块或任务说明 信息修改 密码修改 部分界面设计 3.自己的代 ...

  10. 201521123048 《Java程序设计》第9周学习总结

    1. 本周学习总结 2. 书面作业 本次PTA作业题集异常 常用异常 题目5-1 1.1 截图你的提交结果(出现学号) 1.2 自己以前编写的代码中经常出现什么异常.需要捕获吗(为什么)?应如何避免? ...