摘要: 1 var obj = {}; 2 3 var f = function () { 4 return this; 5 }; 6 7 f() window // true 8 f.call(obj) obj // true f的内部有this this的指向不唯一,可变化 在全局环境运行f,this指 阅读全文
posted @ 2021-01-23 22:03 呈心者 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 有一构造函数如下: 1 function Shape() { 2 this.x = 0; 3 this.y = 0; 4 } 5 6 Shape.prototype.move = function (x, y) { 7 this.x += x; 8 this.y += y; 9 console.in 阅读全文
posted @ 2021-01-23 21:50 呈心者 阅读(71) 评论(0) 推荐(0) 编辑