To add private variable to this Javascript literal object
You can use number as function/variable name, the numberic name can't be accessed from parent scope, but can be accessed by 'this' in private scope.
var o=
{
attr1:'value of attr1',
1:'private attr ,the index is 1',
301:function(){
console.log('private function , name is 2');
},
fun1:function(){
console.log(this[1]);
this[301].call(this);
}
}; o.fun1();
To add private variable to this Javascript literal object的更多相关文章
- Private Variable
		
Any variable defined inside a function is considered private since it is inaccessable outside that f ...
 - unity c# script  error CS0664: Literal of type double cannot be implicitly converted to type `float'. Add suffix `f' to create a literal of this type
		
例如在unity c# script中定义 private float x=0.0; 则会报 error CS0664: Literal of type double cannot be implic ...
 - python之private variable
		
[python之private variable] Since there is a valid use-case for class-private members (namely to avoid ...
 - Python私有变量(Private Variable)
		
Variables can be private which can be useful on many occasions. A private variable can only be chang ...
 - Private Variable and Private Method - Python 私有变量 和 私有方法
		
Private Variable and Private Method Python 不象 Java 那样, 通过 private 关键字创建私有属性, python 通过更简洁的实现了'私有属性', ...
 - JavaScript中Object的总结
		
基于原型继承,动态对象扩展,闭包,JavaScript已经成为当今世界上最灵活和富有表现力的编程语言之一. 这里有一个很重要的概念需要特别指出:在JavaScript中,包括所有的函数,数组,键值对和 ...
 - JavaScript中Object.prototype.toString方法的原理
		
在JavaScript中,想要判断某个对象值属于哪种内置类型,最靠谱的做法就是通过Object.prototype.toString方法. ? 1 2 var arr = []; console.lo ...
 - 从头开始学JavaScript (十一)——Object类型
		
原文:从头开始学JavaScript (十一)--Object类型 一.object类型 一个object就是一系列属性的集合,一个属性包含一个名字(属性名)和一个值(属性值). object对于在应 ...
 - JavaScript之Object拆解
		
转载烦请注明原文链接: https://github.com/Xing-Chuan/blog/blob/master/JavaScript/JavaScript%E4%B9%8BObject%E6%8 ...
 
随机推荐
- 安装node_modules文件遇到的问题:更改代理
			
npm 1080 1081
 - MySQL深入利用Ameoba实现读写分离
			
3 ameoba安装配置 3.1 安装配置JDK [root@stu15 ~]# rpm -ivh jdk-7u67-linux-x64.rpm [root@stu15 ~]# cd /usr/j ...
 - zencart用chrome无法登录后台
			
再本地安装完zencart后,可以使用ie和Firefox登录网站后台,但是使用chrome登录时,页面闪一下,然后又跳转到登录页面. 按如下设置可以解决该问题: 中文版:商店设置->Sessi ...
 - iOS 技术博客分享
			
1.了解有什么新技术 1> 苹果API文档 - General - Guides - iOSx API Diffs 2> 观看WWDC会议视频 2.如何使用新技术 1> 自己根据AP ...
 - SMTP Failed on Process Scheduler
			
If you are seeing messages like this in your message log when running a process through the process ...
 - Centos 7.1+CDH5.7.2全部署流程
			
前期准备: JDK环境 版本:jdk-8u101-linux-x64.rpm 下载地址:oracle官网 mysql rpm包:http://dev.mysql.com/get/Downloads/M ...
 - CodeBlocks集成cppcheck
			
From:http://www.cnblogs.com/killerlegend/p/3624117.html Writer:KillerLegend CodeBlocks本身配置了cppcheck的 ...
 - Python学习教程(learning Python)--1.2.4 Python格式化输出科学计数
			
Python在浮点数据输出时,可以采用科学计数法的方式输出. 现举两个例子说明一下如何使用. eg1. 无精度要求的科学计数法浮点数据输出 >>> print(format(1234 ...
 - spring error
			
<aop:config> <aop:pointcut id="allMethod" expression="execution(* a.j.shop.s ...
 - [css filter]filter在界面实现滤镜效果
			
最近逛当当,发现当当尾品会的首页推荐最底端的商品链接是灰色的图片,然后鼠标hover之后就会变成正常的彩色 肯定不是通过img来改变的,然后直接看了一下源码,其实是用的filter属性 _(:з」∠) ...