배열 메서드의 두 번째 인자 thisArg 는 콜백 안의 this 가 된다. 비교할 값을 this 로 받는 function 하나를 만들어 두면 arr.filter(isId, 3), arr.find(isId, 7) 처럼 값만 바꿔 여러 검색에 재사용할 수 있다. 화살표 함수는 자기 this 가 없어 thisArg 가 무시되고, 이 방식은 화살표 함수보다 느릴 수 있다.

-- thisArg = 콜백의 this. 비교할 값을 this 로 받는 함수 하나를 재사용
filterWith :: (b -> a -> Bool) -> b -> [a] -> [a]
filterWith pred this = filter (pred this)     -- arr.filter(callback, thisArg)

isId :: Int -> Item -> Bool
isId this item = itemId item == this          -- function isId(item) { return item.id === this }

filterWith isId 3 items
-- 화살표 함수는 자기 this 가 없어 thisArg 무시 · 화살표보다 느릴 수 있다
#8