const _max = Math.max.bind(Math); 和 const _max = Math.max 有什么区别

const _max = Math.max.bind(Math); 和 const _max = Math.max 有什么区别

这个你要去研究一下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)

你跑一下这个代码,应该就能明白了。