随笔分类 -  javascript

摘要:bind与call, apply一样,就是用来改变this指向的,不同的是,bind不会执行函数,而是返回一个新的函数 var name = '小王', age = 17; var obj = { name: '小张', objAge: this.age, myFun: function() { c 阅读全文
posted @ 2021-01-03 15:42 helloworld!!!? 阅读(725) 评论(0) 推荐(0)
摘要:数组的push方法相信大家都非常熟悉了,但是push方法的实现原理,又是怎么样的呢,首先来看一道题: let obj = { 2: 'a', 3: 'b', length: 2, push: Array.prototype.push } obj.push('c', 'd'); console.log 阅读全文
posted @ 2020-08-12 00:06 helloworld!!!? 阅读(2927) 评论(0) 推荐(0)