call,apply,bind

김_리트리버·2020년 9월 30일
0

1> call

전달인자로 this 와 다른 인수들을 넘긴 함수를 호출 한다.

func.call(thisArg[, arg1[, arg2[, ...]]])

2> apply

func.apply(thisArg, [argsArray])

call 과 기능은 유사하나 this 이외에 전달인자를 받을 때 배열로 받음

2> bind

전달인자로 this 를 포함된 함수의 복제본을 리턴한다.

func.bind(thisArg[, arg1[, arg2[, ...]]])

ex> 리액트 클래스 컴포넌트에서 메서드 정의하고 props 로 넘길 때

profile
web-developer

0개의 댓글