js中bind、call、apply函数的用法
来源:互联网 发布:淘宝二手手机苹果 编辑:程序博客网 时间:2024/05/20 22:39
1
2
3
4
5
6
7
var
a = {
v : 0,
f :
function
(xx) {
this
.v = xx;
}
}
a.f(5);
1
2
3
4
function
f(xx) {
this
.x = xx;
}
f(5);
1
2
3
4
function
a(xx) {
this
.m = xx;
}
var
b =
new
a(5);
1
2
3
4
5
6
7
function
a(xx) {
this
.b = xx;
}
var
o = {};
a.apply(o, [5]);
alert(a.b);
// undefined
alert(o.b);
// 5
1
2
3
4
5
6
7
function
a(xx, yy) {
alert(xx, yy);
alert(
this
);
alert(arguments);
}
a.apply(
null
, [5, 55]);
a.call(
null
, 5, 55);
1
2
3
4
5
6
7
8
9
10
var
m = {
"x"
: 1
};
function
foo(y) {
alert(
this
.x + y);
}
foo.apply(m, [5]);
foo.call(m, 5);
var
foo1 = foo.bind(m, 5);
foo1();
1
function
jam() {};
1
var
jam =
function
() {};
1
function
jam() {}();
1
(
function
jam() {}());
阅读全文
0 0
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- js中bind、call、apply函数的用法
- !!js中call、apply、bind的用法
- js中call、apply、bind的用法
- Javascript中bind、call、apply函数用法
- Javascript中bind、call、apply函数用法
- js中call、apply、bind函数
- Javascript中call,apply,bind三个函数的用法
- JavaScript中call、apply、bind函数的用法
- JS中apply call bind的区别
- JS中call、apply、bind的区别
- XML系列之--Linq操作带属性的XML(四)
- UVA10385
- Skynet安装及配置
- mybatis在eclipse中自动生成
- CSDN-markdown编辑器
- js中bind、call、apply函数的用法
- 词根- abl = able, 表示能力
- 游戏物理数学之《Matrix矩阵》
- 1567:是不是太胖了
- 9-3NOIP模拟赛总结
- Hibernate查询语言HQL
- Java多线程--As-if-sreial语义
- ACM模版-f_zyj v 2.0——更新通知
- Object(equals,finalize,clone,hashCode,toString),与包的重名