js之中使用 this 的原因
来源:互联网 发布:什么是云计算服务器 编辑:程序博客网 时间:2024/06/06 04:05
使用 this 的原因
为什么使用 this 呢?因为在实例化对象时,总是不能确定开发者会使用什么样的变量名。使用 this,即可在任何多个地方重用同一个函数。请思考下面的例子:
function showColor() { alert(this.color
);};var oCar1 = new Object;oCar1.color = "red";oCar1.showColor = showColor;var oCar2 = new Object;oCar2.color = "blue";oCar2.showColor = showColor;oCar1.showColor();//输出 "red"oCar2.showColor();
0 0
- js之中使用 this 的原因
- js中this的使用
- js中this的使用
- this指针的使用js
- js中this的使用
- 编程之中使用的英文
- Angular.js的使用原因
- 在原型链之中的查询及this指向问题
- js中this关键字的使用
- js this,闭包的使用
- JS中this关键字的使用
- JS中的this变量的使用介绍
- JS中的this变量的使用介绍
- JS中的this变量的使用介绍
- JS中的this变量的使用介绍
- js中this的使用案例整理
- WinForm之中BindingNavigator控件的使用
- WinForm之中BindingNavigator控件的使用
- 高性能Mysql主从架构的复制原理及配置详解
- date命令
- 性能分析工具之-- Eclipse Memory Analyzer tool(MAT)(一)
- Mysql安装时出现APPLY security settings错误
- ubuntu下修改hosts文件
- js之中使用 this 的原因
- 文件读写
- OrmLite的快速使用方案
- spark 不支持 嵌入RDDs or 用户定义的函数 that refer to other RDDs 【未完待续】
- Packet for query is too large (12238 > 1024). You can change this value
- iOS开发之pch
- Linux学习教程(八)系统启动流程
- Utuntu 12.04 LTS 安装ibus
- 性能分析工具之-- Eclipse Memory Analyzer tool(MAT)(二)