From 0c90aa3e3cb16d48190a7bbd78fde74ef15c9aa0 Mon Sep 17 00:00:00 2001 From: maruf1020 Date: Tue, 19 Jul 2022 17:36:33 +0600 Subject: [PATCH] Wanna know I just wanna know which one is better. --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 36136a0..73cbd50 100644 --- a/index.js +++ b/index.js @@ -39,6 +39,7 @@ result = people.reduce((acc, person) => { }, null); // find by name +people.reduce((acc, person) => person.name === 'Leigh' ? acc = person : acc = acc) result = people.reduce((acc, person) => { if (acc !== null) return acc;