SOURCE

let obj = {name: 'tony'};
  
  function Child(name){
    this.name = name;
  }
  
  Child.prototype = {
    constructor: Child,
    showName: function(){
      console.log(this.name);
    }
  }
  var child = new Child('thomas');
  child.showName(); // thomas
  
  //  call,apply,bind使用
  child.showName.call(obj);
  child.showName.apply(obj);
  let bind = child.showName.bind(obj); // 返回一个函数
  bind(); // tony 需要调用时才能改变指向
  child.showName()
  child.showName.apply({name:'11'});
  child.showName.call({name:'11'});

  let arr1 = [1, 2, 19, 6];
console.log(Math.max.call(null, 1,2,19,6)); // 19
console.log(Math.max.call(null, arr1)); // NaN
console.log(Math.max.apply(null, arr1)); //  19 直接可以用arr1传递进去
console.log(Math.max.bind(null, 1,2,19,6)); // 
let s = Math.max.bind(null, 1,2,19,6)//传参和call一样,但是需要调用
console.log(s())
console 命令行工具 X clear

                    
>
console