當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
前端学习(1703):前端系列javascript之问题解答
生活随笔
收集整理的這篇文章主要介紹了
前端学习(1703):前端系列javascript之问题解答
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
function fn1(a, b) {console.log('this', this)console.log(a, b)return 'this is fn1'
}
const fn2 = fn1.bind({ x: 100 }, 10, 20, 30);
const res = fn2();
console.log(res);//模擬bind
Function.prototype.bind1 = function() {const args = Array.prototype.slice.call(arguments)//獲取thisconst t = args.shift();//this的bind里的fn1const self = thisreturn function() {return self.apply(t, args);}
}
?
總結
以上是生活随笔為你收集整理的前端学习(1703):前端系列javascript之问题解答的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2.vue的不更新特性-重用机制和key
- 下一篇: QT下的音乐播放器 (一)