12 2019 档案

摘要:1.函数预编译过程 this >window。 2.全局作用域里this >window。 3.call/apply 可以改变函数运行时this指向。 4.obj.func(); func()里面的this指向boj。 阅读全文
posted @ 2019-12-29 15:10 另一场风花雪月 阅读(120) 评论(0) 推荐(0)
摘要:function Father () { } Father.prototype.lastName = "Zhang"; function Son () { } Son.prototype = Father.prototype; function F () {} function inherit (T 阅读全文
posted @ 2019-12-21 16:37 另一场风花雪月 阅读(218) 评论(0) 推荐(0)
摘要:Person.prototype.name = "sunny"; function Person () { } var person = new Person(); Person.prototype = { name : "cherry" } Person的name最终为“sunny”,原因如下: 阅读全文
posted @ 2019-12-13 17:54 另一场风花雪月 阅读(102) 评论(0) 推荐(0)
摘要:var obj = { name : "XiaoQi", sex : 'female', age : 18, stature : 160, weight : 90, apple : function () { console.log('I am eating apple!!!'); this.wei 阅读全文
posted @ 2019-12-08 19:33 另一场风花雪月 阅读(314) 评论(0) 推荐(0)
摘要:1.在函数体最前面隐式地加上this = {} 2.执行 this.xxx = xxx; 3.在函数最后隐式return this 阅读全文
posted @ 2019-12-06 17:21 另一场风花雪月 阅读(153) 评论(0) 推荐(0)
摘要:包装类习题 阅读全文
posted @ 2019-12-06 17:16 另一场风花雪月 阅读(120) 评论(0) 推荐(0)
摘要:写4个内容为a的li标签,要求加入一个单击事件,单击之后打印该“a”的索引,方法如图2,但打印出来的结果全是4。因为将console.log放入onclick事件中已发送到外部,形成了闭包,(此外部已是javascript标签之外) 要求打印对应索引0 - 3. 方法如下 将函数表达式写入立即执行函 阅读全文
posted @ 2019-12-01 15:32 另一场风花雪月 阅读(182) 评论(0) 推荐(0)