# apply、call、bind

Methods like call(), and apply() can refer this to any object.

new 关键词执行之后总是会返回一个对象,要么是实例对象,要么是 return 语句指定的对象。

After the new keyword is executed, an object is always returned, either an instance object or the object specified by the return statement.

# apply & call & bind 原理介绍

首先,call、apply 和 bind 都是挂在 Function 对象上的方法,调用这三个方法的必须是一个函数

fn.call(thisArg, param1, param2, ...)
fn.bind(thisArg, param1, param2, ...)
fn.apply(thisArg, [param1, param2, ...])

fn 是要调用的函数,thisArg 一般为 this 所指向的对象。

Common thing: All of them can change where this refers to the function fn.

Different: Bind is not executed immediately, the other two are executed immediately after changing this refers.

# 应用场景