const _max = Math.max.bind(Math); 和 const _max = Math.max 有什么区别
1条回答 默认 最新
- _念_ 2022-02-22 16:14关注
这个你要去研究一下bind的源码。从最终结果来说区别不大。
let fn1 = Math.max.bind(Math); let fn2 = Math.max let fn3 = Math.max let fn4 = Math.max.bind(Math); fn1(1,2) fn2(1,2) fn3(1,2) fn4(1,2) console.log(fn1 == fn2) console.log(fn2 == fn3) console.log(fn3 == fn4) console.log(fn1 == fn4)
你跑一下这个代码,应该就能明白了。
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用