- 博客(3)
- 收藏
- 关注
原创 [js] this
mdn my git this由调用方法与位置决定,与定义位置,作用域,上下文均无关 全局 绑定到全局对象 this // window console.log(this) // window 函数调用 简单调用 绑定到全局 function f() { console.log(this); } f(); // window 严格模式会绑定到un
2016-08-31 15:59:27 252
原创 [js] 函数 闭包
函数声明 函数声明与函数表达式 函数声明会自动提升(function declaration hoisting) test(); function test() {console.log('for fun')} // for fun test(); var test = function() {} // error if(condition){ function sayHi(){/*d
2016-08-30 09:25:58 374
原创 [js] 原型 继承 委托
每个函数都有prototype属性,prototype是一个指向原型对象的指针 例外:通过Function.prototype.bind方法构造出来的函数没有prototype属性 function Point(x, y) { this.x = x; this.y = y; } var Y = Point.bind(null, 0, 3); Point.prototype // Ob
2016-08-29 16:08:45 472
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人