From dc1f2c727cbb9c84b54daa8afde11a969a0e94d1 Mon Sep 17 00:00:00 2001 From: Fatai Raheem Date: Mon, 30 Mar 2026 12:21:46 +0100 Subject: [PATCH] Fixed Difference of Set example on 10_day_Sets_and_Maps.md The Difference of Set example on Day 10 only filters the number difference in set A without accounting for the difference in set B. I add a line that account for the difference in set A and also updated the output --- 10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md b/10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md index 25dafe988..858e8aeab 100644 --- a/10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md +++ b/10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md @@ -272,14 +272,17 @@ let b = [3, 4, 5, 6] let A = new Set(a) let B = new Set(b) -let c = a.filter((num) => !B.has(num)) -let C = new Set(c) +let diffOfA = a.filter((num) => !B.has(num)) +let diffOfB = b.filter((num) => !A.has(num)) + +let diffOfAB = [...diffOfA, ...diffOfB] +let C = new Set(diffOfAB) console.log(C) ``` ```sh -Set(2) {1, 2} +Set(2) {1, 2, 6} ``` ## Map