摘要: `this`的灵活性让编程困难了许多,因此需要一些方法把this给固定下来。 Function.prototype.call(thisValue, arg1, arg2, ...) 函数实例 的 可以指定函数内部this的指向。 的参数应当是一个对象。若 、`null undefined`则是全局对 阅读全文
posted @ 2020-05-12 16:12 NullCream 阅读(620) 评论(0) 推荐(0) 编辑
摘要: #This的含义 首先,this在构造函数中可以表示实例对象。 function Person(name,gender){ this.name = name; this.gender= gender; } 而在其他地方,this则表示属性和方法当前所在的对象。this的值就是在点之前的这个对象,即调 阅读全文
posted @ 2020-05-12 15:18 NullCream 阅读(316) 评论(0) 推荐(0) 编辑