From f504a8cf77fd543ab508e36065ea33f3043c7dd1 Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Sat, 16 Dec 2017 18:06:11 +0530 Subject: [PATCH] Update First-one-to-pass-truth-test.md --- snippets/First-one-to-pass-truth-test.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/First-one-to-pass-truth-test.md b/snippets/First-one-to-pass-truth-test.md index 7c50de1a0..0732eb51c 100644 --- a/snippets/First-one-to-pass-truth-test.md +++ b/snippets/First-one-to-pass-truth-test.md @@ -3,9 +3,8 @@ A function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument). ``` -function findElement(arr, func) { +findElement = (arr, func) => { filterArr = arr.filter(func); //filter array with the function provided - return filterArr[0]; //return the first element that returns true, or undefined if no elements return true }