From 25bd92ce9438c131fcf9d767c7ee4ca6fd382407 Mon Sep 17 00:00:00 2001 From: shfshanyue Date: Tue, 7 Mar 2017 16:54:47 +0800 Subject: [PATCH] Make easy for example of hoc --- readme.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/readme.md b/readme.md index 95f31f0..d76d4c4 100644 --- a/readme.md +++ b/readme.md @@ -80,15 +80,7 @@ console.log(arity) // 2 A function which takes a function as an argument and/or returns a function. ```js -const filter = (predicate, xs) => { - const result = [] - for (let idx = 0; idx < xs.length; idx++) { - if (predicate(xs[idx])) { - result.push(xs[idx]) - } - } - return result -} +const filter = (predicate, xs) => xs.filter(predicate) ``` ```js