From 4bea22341d1e9564d148ab4f86a7efd58e078b7d Mon Sep 17 00:00:00 2001 From: Meet Zaveri Date: Sat, 16 Dec 2017 18:21:21 +0530 Subject: [PATCH] Update Truth-check-objects.md --- snippets/Truth-check-objects.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/snippets/Truth-check-objects.md b/snippets/Truth-check-objects.md index 042d14605..6404a22f0 100644 --- a/snippets/Truth-check-objects.md +++ b/snippets/Truth-check-objects.md @@ -9,10 +9,7 @@ Check if the predicate (second argument) is truthy on all elements of a collecti - Also if the object is empty then it will return false ``` - function truthCheck(collection, pre) { - // Is everyone being true? - return collection.every(obj => obj[pre]); -} +truthCheck = (collection, pre) => (collection.every(obj => obj[pre])); truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");