JS -- Variables As Properties
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的更多相关文章
- [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 ...
- jquery.i18n.properties.js hacking
/****************************************************************************** * jquery.i18n.proper ...
- 分别用Java和JS读取Properties文件内容
项目中经常用到的配置文件,除了XML文件之外,还会用到Properties文件来存储一些信息,例如国际化的设置.jdbc连接信息的配置等.有时候也会把一些路径或者sql语句放到Properties中, ...
- JS -- The Scope Chain 作用域链
The Scope Chain JavaScript is a lexically scoped language: the scope of a variable can be thought of ...
- 基于jQuery.i18n.properties实现前端网站语言多版本
我是参考播客做了个demo:http://blog.csdn.net/aixiaoyang168/article/details/49336709 jQuery.i18n.properties采用.p ...
- 使用 pdf.js 查看发票时,显示不了台头和印章的解决办法
系统中使用了 pdf.js 来查看 PDF 文件,发现在查看 电子发票时, 缺失了很多信息, 刚开始以为是 PDF.JS 的 BUG, 后来调试发现只需要在 IIS 里添加一个 bcmap 后缀的 m ...
- 纯js国际化(i18n)
i18n,是internationalization单词的简写,中间18个字符略去,简称i18n,意图就是实现国际化,方便产品在不同的场景下使用 目标:可以点击切换语言或者ChangeLanguage ...
- 解决前端js、css缓存问题
去js标签库查询jquery.i18n.properties.js这个js引用到页面上: 新建一个配置文件:用上面的那个js方法调取配置文件里的版本号给其他的js加上: 示例: <script ...
- A Study of WebRTC Security
转自:http://webrtc-security.github.io/ A Study of WebRTC Security Abstract Web Real-Time Communication ...
随机推荐
- ConcurrentHashmap中的size()方法简单解释
本文所有的源码都是基于JDK1.8 ConcurrentHashmap中的size()方法源码: public int size() { long n = sumCount(); return ((n ...
- Dom-创建标签
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- webstom破解
链接:http://pan.baidu.com/s/1dFOpj1n 密码:rsfs
- jmeter 非gui 模式跑jmx
D:\study\apache-jmeter-3.0\bin>jmeter -n -t D:\study\apache-jmeter-3.0\基金排行.jmx -l D:\study\apach ...
- AHD-模拟高清芯片RN6752替代TVP5150/CJC5150
RN6752功能:2路CVBS转BT656/601/1302高清视频解码芯片.产品特征输入:2路CVBS(不能同时输入)和S-VIDEO(一般不用)输出:BT601/656/1302支持NTSC,PA ...
- MySQL的JOIN(三):JOIN优化实践之内循环的次数
这篇博文讲述如何优化内循环的次数.内循环的次数受驱动表的记录数所影响,驱动表记录数越多,内循环就越多,连接效率就越低下,所以尽量用小表驱动大表.先插入测试数据. CREATE TABLE t1 ( i ...
- WCF(一)基础整理
学习WCF之前,了解下WCF和WebService的区别. WCF和WebService区别 Web Service严格来说是行业标准,也就是Web Service 规范,它使用XML扩展标记语言来表 ...
- 转:【Java并发编程】之二十三:并发新特性—信号量Semaphore(含代码)
载请注明出处:http://blog.csdn.net/ns_code/article/details/17524153 在操作系统中,信号量是个很重要的概念,它在控制进程间的协作方面有着非常重要的作 ...
- 使用 LVS 实现负载均衡原理及安装配置详解
负载均衡集群是 load balance 集群的简写,翻译成中文就是负载均衡集群.常用的负载均衡开源软件有nginx.lvs.haproxy,商业的硬件负载均衡设备F5.Netscale.这里主要是学 ...
- 【Beta】Daily Scrum Meeting——Day7
站立式会议照片 1.本次会议为第七次Meeting会议: 2.本次会议在中午12点,在陆大楼召开,本次会议为30分钟讨论今天要完成的任务以及接下来的任务安排. 燃尽图 每个人的工作分配 成 员 昨天已 ...