diff --git a/README.md b/README.md index 4dbfe200a..476f862a9 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ * [Random integer in range](#random-integer-in-range) * [Random number in range](#random-number-in-range) * [Randomize order of array](#randomize-order-of-array) -* [Redirect to URL](#redirect-to-url) +* [Redirect to url](#redirect-to-url) * [Reverse a string](#reverse-a-string) * [RGB to hexadecimal](#rgb-to-hexadecimal) * [Run promises in series](#run-promises-in-series) @@ -91,7 +91,7 @@ const anagrams = str => { // anagrams('abc') -> ['abc','acb','bac','bca','cab','cba'] ``` -### Array difference (complement) +### Array difference Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values not contained in `b`. @@ -100,7 +100,7 @@ const difference = (a, b) => { const s = new Set(b); return a.filter(x => !s.has // difference([1,2,3], [1,2]) -> [3] ``` -### Array intersection (Common values between two arrays) +### Array intersection Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values contained in `b`. diff --git a/snippets/array-difference.md b/snippets/array-difference.md index 74e518f5c..46469b1d6 100644 --- a/snippets/array-difference.md +++ b/snippets/array-difference.md @@ -1,4 +1,4 @@ -### Array difference (complement) +### Array difference Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values not contained in `b`. diff --git a/snippets/array-intersection.md b/snippets/array-intersection.md index 909c4312d..87c42378b 100644 --- a/snippets/array-intersection.md +++ b/snippets/array-intersection.md @@ -1,4 +1,4 @@ -### Array intersection (Common values between two arrays) +### Array intersection Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values contained in `b`.