diff --git a/snippets/JSONToFile.md b/snippets/JSONToFile.md
index a2a61a5e2..12e6eb0d5 100644
--- a/snippets/JSONToFile.md
+++ b/snippets/JSONToFile.md
@@ -15,5 +15,6 @@ const JSONToFile = (obj, filename) =>
```
```js
-JSONToFile({ test: 'is passed' }, 'testJsonFile'); // writes the object to 'testJsonFile.json'
+JSONToFile({ test: 'is passed' }, 'testJsonFile');
+// writes the object to 'testJsonFile.json'
```
diff --git a/snippets/JSONtoCSV.md b/snippets/JSONtoCSV.md
index 00fe26b7c..b9664a644 100644
--- a/snippets/JSONtoCSV.md
+++ b/snippets/JSONtoCSV.md
@@ -24,6 +24,13 @@ const JSONtoCSV = (arr, columns, delimiter = ',') =>
```
```js
-JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b']); // 'a,b\n"1","2"\n"3","4"\n"6",""\n"","7"'
-JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'], ';'); // 'a;b\n"1";"2"\n"3";"4"\n"6";""\n"";"7"'
+JSONtoCSV(
+ [{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }],
+ ['a', 'b']
+); // 'a,b\n"1","2"\n"3","4"\n"6",""\n"","7"'
+JSONtoCSV(
+ [{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }],
+ ['a', 'b'],
+ ';'
+); // 'a;b\n"1";"2"\n"3";"4"\n"6";""\n"";"7"'
```
diff --git a/snippets/includesAll.md b/snippets/includesAll.md
index 2d6afcaa8..b9a3a6c9a 100644
--- a/snippets/includesAll.md
+++ b/snippets/includesAll.md
@@ -3,7 +3,7 @@ title: includesAll
tags: array,beginner
---
-Returns `true` if all the elements in `values` are included in `arr`, `false` otherwise.
+Checks if all the elements in `values` are included in `arr`.
- Use `Array.prototype.every()` and `Array.prototype.includes()` to check if all elements of `values` are included in `arr`.
diff --git a/snippets/includesAny.md b/snippets/includesAny.md
index a8a4bc7d6..f7614aa2e 100644
--- a/snippets/includesAny.md
+++ b/snippets/includesAny.md
@@ -3,7 +3,7 @@ title: includesAny
tags: array,beginner
---
-Returns `true` if at least one element of values is included in arr , `false` otherwise.
+Checks if at least one element of `values` is included in `arr`.
- Use `Array.prototype.some()` and `Array.prototype.includes()` to check if at least one element of `values` is included in `arr`.
diff --git a/snippets/indentString.md b/snippets/indentString.md
index b5c182d87..c4d7f632c 100644
--- a/snippets/indentString.md
+++ b/snippets/indentString.md
@@ -9,7 +9,8 @@ Indents each line in the provided string.
- Omit the third parameter, `indent`, to use a default indentation character of `' '`.
```js
-const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count));
+const indentString = (str, count, indent = ' ') =>
+ str.replace(/^/gm, indent.repeat(count));
```
```js
diff --git a/snippets/indexOfAll.md b/snippets/indexOfAll.md
index d566cd052..4b7abbf29 100644
--- a/snippets/indexOfAll.md
+++ b/snippets/indexOfAll.md
@@ -3,14 +3,14 @@ title: indexOfAll
tags: array,intermediate
---
-Returns all indices of `val` in an array.
-If `val` never occurs, returns `[]`.
+Returns all indexes of `val` in an array.
+If `val` never occurs, returns an empty array.
-- Use `Array.prototype.reduce()` to loop over elements and store indices for matching elements.
-- Return the array of indices.
+- Use `Array.prototype.reduce()` to loop over elements and store indexes for matching elements.
```js
-const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);
+const indexOfAll = (arr, val) =>
+ arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);
```
```js
diff --git a/snippets/initial.md b/snippets/initial.md
index 5149e7c61..f297f100a 100644
--- a/snippets/initial.md
+++ b/snippets/initial.md
@@ -5,12 +5,12 @@ tags: array,beginner
Returns all the elements of an array except the last one.
-- Use `arr.slice(0,-1)` to return all but the last element of the array.
+- Use `Array.prototype.slice(0,-1)` to return all but the last element of the array.
```js
const initial = arr => arr.slice(0, -1);
```
```js
-initial([1, 2, 3]); // [1,2]
+initial([1, 2, 3]); // [1, 2]
```
diff --git a/snippets/initialize2DArray.md b/snippets/initialize2DArray.md
index 45bc2ba17..90ded7996 100644
--- a/snippets/initialize2DArray.md
+++ b/snippets/initialize2DArray.md
@@ -5,8 +5,9 @@ tags: array,intermediate
Initializes a 2D array of given width and height and value.
-- Use `Array.prototype.map()` to generate h rows where each is a new array of size w initialize with value.
-- If the value is not provided, default to `null`.
+- Use `Array.from()` and `Array.prototype.map()` to generate `h` rows where each is a new array of size `w`.
+- Use `Array.prototype.fill()` to initialize all items with value `val`.
+- Omit the last argument, `val`, to use a default value of `null`.
```js
const initialize2DArray = (w, h, val = null) =>
@@ -14,5 +15,5 @@ const initialize2DArray = (w, h, val = null) =>
```
```js
-initialize2DArray(2, 2, 0); // [[0,0], [0,0]]
+initialize2DArray(2, 2, 0); // [[0, 0], [0, 0]]
```
diff --git a/snippets/initializeArrayWithRange.md b/snippets/initializeArrayWithRange.md
index 514cdace2..7925fbb65 100644
--- a/snippets/initializeArrayWithRange.md
+++ b/snippets/initializeArrayWithRange.md
@@ -1,13 +1,14 @@
---
title: initializeArrayWithRange
-tags: array,math,intermediate
+tags: array,intermediate
---
Initializes an array containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.
-- Use `Array.from()` to create an array of the desired length, `(end - start + 1)/step`, and a map function to fill it with the desired values in the given range.
-- You can omit `start` to use a default value of `0`.
-- You can omit `step` to use a default value of `1`.
+- Use `Array.from()` to create an array of the desired length.
+- Use `(end - start + 1)/step` and a map function to fill the array with the desired values in the given range.
+- Omit the second argument, `start`, to use a default value of `0`.
+- Omit the last argument, `step`, to use a default value of `1`.
```js
const initializeArrayWithRange = (end, start = 0, step = 1) =>
@@ -15,7 +16,7 @@ const initializeArrayWithRange = (end, start = 0, step = 1) =>
```
```js
-initializeArrayWithRange(5); // [0,1,2,3,4,5]
-initializeArrayWithRange(7, 3); // [3,4,5,6,7]
-initializeArrayWithRange(9, 0, 2); // [0,2,4,6,8]
+initializeArrayWithRange(5); // [0, 1, 2, 3, 4, 5]
+initializeArrayWithRange(7, 3); // [3, 4, 5, 6, 7]
+initializeArrayWithRange(9, 0, 2); // [0, 2, 4, 6, 8]
```
diff --git a/snippets/initializeArrayWithRangeRight.md b/snippets/initializeArrayWithRangeRight.md
index bd5c06e97..e3d3a1c7d 100644
--- a/snippets/initializeArrayWithRangeRight.md
+++ b/snippets/initializeArrayWithRangeRight.md
@@ -1,13 +1,13 @@
---
title: initializeArrayWithRangeRight
-tags: array,math,intermediate
+tags: array,intermediate
---
Initializes an array containing the numbers in the specified range (in reverse) where `start` and `end` are inclusive with their common difference `step`.
- Use `Array.from(Math.ceil((end+1-start)/step))` to create an array of the desired length(the amounts of elements is equal to `(end-start)/step` or `(end+1-start)/step` for inclusive end), `Array.prototype.map()` to fill with the desired values in a range.
-- You can omit `start` to use a default value of `0`.
-- You can omit `step` to use a default value of `1`.
+- Omit the second argument, `start`, to use a default value of `0`.
+- Omit the last argument, `step`, to use a default value of `1`.
```js
const initializeArrayWithRangeRight = (end, start = 0, step = 1) =>
@@ -17,7 +17,7 @@ const initializeArrayWithRangeRight = (end, start = 0, step = 1) =>
```
```js
-initializeArrayWithRangeRight(5); // [5,4,3,2,1,0]
-initializeArrayWithRangeRight(7, 3); // [7,6,5,4,3]
-initializeArrayWithRangeRight(9, 0, 2); // [8,6,4,2,0]
+initializeArrayWithRangeRight(5); // [5, 4, 3, 2, 1, 0]
+initializeArrayWithRangeRight(7, 3); // [7, 6, 5, 4, 3]
+initializeArrayWithRangeRight(9, 0, 2); // [8, 6, 4, 2, 0]
```
diff --git a/snippets/initializeArrayWithValues.md b/snippets/initializeArrayWithValues.md
index 3321d9968..251683434 100644
--- a/snippets/initializeArrayWithValues.md
+++ b/snippets/initializeArrayWithValues.md
@@ -1,15 +1,16 @@
---
title: initializeArrayWithValues
-tags: array,math,intermediate
+tags: array,intermediate
---
Initializes and fills an array with the specified values.
-- Use `Array(n)` to create an array of the desired length, `fill(v)` to fill it with the desired values.
-- You can omit `val` to use a default value of `0`.
+- Use `Array.from()` to create an array of the desired length, `Array.prototype.fill()` to fill it with the desired values.
+- Omit the last argument, `val`, to use a default value of `0`.
```js
-const initializeArrayWithValues = (n, val = 0) => Array(n).fill(val);
+const initializeArrayWithValues = (n, val = 0) =>
+ Array.from({ length: n }).fill(val);
```
```js
diff --git a/snippets/initializeNDArray.md b/snippets/initializeNDArray.md
index 46758803b..2a44b1d9b 100644
--- a/snippets/initializeNDArray.md
+++ b/snippets/initializeNDArray.md
@@ -6,7 +6,7 @@ tags: array,recursion,intermediate
Create a n-dimensional array with given value.
- Use recursion.
-- Use `Array.prototype.map()` to generate rows where each is a new array initialized using `initializeNDArray`.
+- Use `Array.from()`, `Array.prototype.map()` to generate rows where each is a new array initialized using `initializeNDArray()`.
```js
const initializeNDArray = (val, ...args) =>
@@ -16,6 +16,6 @@ const initializeNDArray = (val, ...args) =>
```
```js
-initializeNDArray(1, 3); // [1,1,1]
-initializeNDArray(5, 2, 2, 2); // [[[5,5],[5,5]],[[5,5],[5,5]]]
+initializeNDArray(1, 3); // [1, 1, 1]
+initializeNDArray(5, 2, 2, 2); // [[[5, 5], [5, 5]], [[5, 5], [5, 5]]]
```
diff --git a/snippets/injectCSS.md b/snippets/injectCSS.md
index c4514206b..f21935528 100644
--- a/snippets/injectCSS.md
+++ b/snippets/injectCSS.md
@@ -3,10 +3,11 @@ title: injectCSS
tags: browser,css,intermediate
---
-Injects the given css code into the current document
+Injects the given CSS code into the current document
- Use `Document.createElement()` to create a new `style` element and set its type to `text/css`.
-- Use `Element.innerText` to set the value to the given css string, `Document.head` and `Element.appendChild()` to append the new element to the document head.
+- Use `Element.innerText` to set the value to the given CSS string.
+- Use `Document.head` and `Element.appendChild()` to append the new element to the document head.
- Return the newly created `style` element.
```js
@@ -20,5 +21,6 @@ const injectCSS = css => {
```
```js
-injectCSS('body { background-color: #000 }'); // ''
+injectCSS('body { background-color: #000 }');
+// ''
```
diff --git a/snippets/insertAfter.md b/snippets/insertAfter.md
index 84a967835..edf11ba1d 100644
--- a/snippets/insertAfter.md
+++ b/snippets/insertAfter.md
@@ -5,10 +5,11 @@ tags: browser,beginner
Inserts an HTML string after the end of the specified element.
-- Use `el.insertAdjacentHTML()` with a position of `'afterend'` to parse `htmlString` and insert it after the end of `el`.
+- Use `Element.insertAdjacentHTML()` with a position of `'afterend'` to parse `htmlString` and insert it after the end of `el`.
```js
-const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlString);
+const insertAfter = (el, htmlString) =>
+ el.insertAdjacentHTML('afterend', htmlString);
```
```js
diff --git a/snippets/insertAt.md b/snippets/insertAt.md
index 5aa56f5cf..2b9bfcd75 100644
--- a/snippets/insertAt.md
+++ b/snippets/insertAt.md
@@ -3,7 +3,7 @@ title: insertAt
tags: array,intermediate
---
-Mutates the original array to insert the given values at the specified index.
+Mutates the original array to insert the given values after the specified index.
- Use `Array.prototype.splice()` with an appropriate index and a delete count of `0`, spreading the given values to be inserted.
diff --git a/snippets/insertBefore.md b/snippets/insertBefore.md
index d0e1fb248..2ddc80aa8 100644
--- a/snippets/insertBefore.md
+++ b/snippets/insertBefore.md
@@ -5,10 +5,11 @@ tags: browser,beginner
Inserts an HTML string before the start of the specified element.
-- Use `el.insertAdjacentHTML()` with a position of `'beforebegin'` to parse `htmlString` and insert it before the start of `el`.
+- Use `Element.insertAdjacentHTML()` with a position of `'beforebegin'` to parse `htmlString` and insert it before the start of `el`.
```js
-const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', htmlString);
+const insertBefore = (el, htmlString) =>
+ el.insertAdjacentHTML('beforebegin', htmlString);
```
```js
diff --git a/snippets/intersection.md b/snippets/intersection.md
index 8c3b052af..3f93dc549 100644
--- a/snippets/intersection.md
+++ b/snippets/intersection.md
@@ -1,9 +1,9 @@
---
title: intersection
-tags: array,math,intermediate
+tags: array,intermediate
---
-Returns the elements that exist in both arrays.
+Returns the elements that exist in both arrays, filtering duplicate values.
- Create a `Set` from `b`, then use `Array.prototype.filter()` on `a` to only keep values contained in `b`.
diff --git a/snippets/intersectionBy.md b/snippets/intersectionBy.md
index 2eb893fb3..d237f082c 100644
--- a/snippets/intersectionBy.md
+++ b/snippets/intersectionBy.md
@@ -5,7 +5,8 @@ tags: array,intermediate
Returns the elements that exist in both arrays, after applying the provided function to each array element of both.
-- Create a `Set` by applying `fn` to all elements in `b`, then use `Array.prototype.filter()` on `a` to only keep elements, which produce values contained in `b` when `fn` is applied to them.
+- Create a `Set` by applying `fn` to all elements in `b`.
+- Use `Array.prototype.filter()` on `a` to only keep elements, which produce values contained in `b` when `fn` is applied to them.
```js
const intersectionBy = (a, b, fn) => {
@@ -16,5 +17,9 @@ const intersectionBy = (a, b, fn) => {
```js
intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); // [2.1]
-intersectionBy([{ title: 'Apple' }, { title: 'Orange' }], [{ title: 'Orange' }, { title: 'Melon' }], x => x.title) // [{ title: 'Orange' }]
+intersectionBy(
+ [{ title: 'Apple' }, { title: 'Orange' }],
+ [{ title: 'Orange' }, { title: 'Melon' }],
+ x => x.title
+); // [{ title: 'Orange' }]
```
diff --git a/snippets/intersectionWith.md b/snippets/intersectionWith.md
index 6daa92e1f..0caa2cdb9 100644
--- a/snippets/intersectionWith.md
+++ b/snippets/intersectionWith.md
@@ -8,9 +8,14 @@ Returns the elements that exist in both arrays, using a provided comparator func
- Use `Array.prototype.filter()` and `Array.prototype.findIndex()` in combination with the provided comparator to determine intersecting values.
```js
-const intersectionWith = (a, b, comp) => a.filter(x => b.findIndex(y => comp(x, y)) !== -1);
+const intersectionWith = (a, b, comp) =>
+ a.filter(x => b.findIndex(y => comp(x, y)) !== -1);
```
```js
-intersectionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b)); // [1.5, 3, 0]
+intersectionWith(
+ [1, 1.2, 1.5, 3, 0],
+ [1.9, 3, 0, 3.9],
+ (a, b) => Math.round(a) === Math.round(b)
+); // [1.5, 3, 0]
```
diff --git a/snippets/invertKeyValues.md b/snippets/invertKeyValues.md
index f1e9aac4f..d5b31ae3e 100644
--- a/snippets/invertKeyValues.md
+++ b/snippets/invertKeyValues.md
@@ -1,12 +1,13 @@
---
title: invertKeyValues
-tags: object,intermediate
+tags: object,advanced
---
-Inverts the key-value pairs of an object, without mutating it. The corresponding inverted value of each inverted key is an array of keys responsible for generating the inverted value. If a function is supplied, it is applied to each inverted key.
+Inverts the key-value pairs of an object, without mutating it.
- Use `Object.keys()` and `Array.prototype.reduce()` to invert the key-value pairs of an object and apply the function provided (if any).
- Omit the second argument, `fn`, to get the inverted keys without applying a function to them.
+- The corresponding inverted value of each inverted key is an array of keys responsible for generating the inverted value. If a function is supplied, it is applied to each inverted key.
```js
const invertKeyValues = (obj, fn) =>
@@ -20,5 +21,6 @@ const invertKeyValues = (obj, fn) =>
```js
invertKeyValues({ a: 1, b: 2, c: 1 }); // { 1: [ 'a', 'c' ], 2: [ 'b' ] }
-invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value); // { group1: [ 'a', 'c' ], group2: [ 'b' ] }
+invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value);
+// { group1: [ 'a', 'c' ], group2: [ 'b' ] }
```
diff --git a/snippets/is.md b/snippets/is.md
index 7cc89ccae..9bc45cf74 100644
--- a/snippets/is.md
+++ b/snippets/is.md
@@ -1,11 +1,12 @@
---
title: is
-tags: type,array,regexp,beginner
+tags: type,array,intermediate
---
Checks if the provided value is of the specified type.
-- Ensure the value is not `undefined` or `null` using `Array.prototype.includes()`, and compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
+- Ensure the value is not `undefined` or `null` using `Array.prototype.includes()`.
+- Compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
```js
const is = (type, val) => ![, null].includes(val) && val.constructor === type;
diff --git a/snippets/isAbsoluteURL.md b/snippets/isAbsoluteURL.md
index aa6ad0646..2bb90898b 100644
--- a/snippets/isAbsoluteURL.md
+++ b/snippets/isAbsoluteURL.md
@@ -1,11 +1,11 @@
---
title: isAbsoluteURL
-tags: string,browser,intermediate
+tags: string,browser,regexp,intermediate
---
-Returns `true` if the given string is an absolute URL, `false` otherwise.
+Checks if the given string is an absolute URL.
-- Use a regular expression to test if the string is an absolute URL.
+- Use `RegExp.prototype.test()` to test if the string is an absolute URL.
```js
const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str);
diff --git a/snippets/isAfterDate.md b/snippets/isAfterDate.md
index 44e23f817..02891b893 100644
--- a/snippets/isAfterDate.md
+++ b/snippets/isAfterDate.md
@@ -3,7 +3,7 @@ title: isAfterDate
tags: date,beginner
---
-Check if a date is after another date.
+Checks if a date is after another date.
- Use the greater than operator (`>`) to check if the first date comes after the second one.
diff --git a/snippets/isAlphaNumeric.md b/snippets/isAlphaNumeric.md
index bfc9a3bb7..d678f7aa5 100644
--- a/snippets/isAlphaNumeric.md
+++ b/snippets/isAlphaNumeric.md
@@ -5,7 +5,7 @@ tags: string,regexp,beginner
Checks if a string contains only alphanumeric characters.
-- Use `RegExp.prototype.test()` to check if input string matches against alphanumeric regex pattern.
+- Use `RegExp.prototype.test()` to check if the input string matches against the alphanumeric regexp pattern.
```js
const isAlphaNumeric = str => /^[a-z0-9]+$/gi.test(str);
diff --git a/snippets/isAnagram.md b/snippets/isAnagram.md
index 4602d1b94..e61ee4e31 100644
--- a/snippets/isAnagram.md
+++ b/snippets/isAnagram.md
@@ -5,7 +5,8 @@ tags: string,regexp,intermediate
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
-- Use `String.prototype.toLowerCase()`, `String.prototype.replace()` with an appropriate regular expression to remove unnecessary characters, `String.prototype.split('')`, `Array.prototype.sort()` and `Array.prototype.join('')` on both strings to normalize them, then check if their normalized forms are equal.
+- Use `String.prototype.toLowerCase()` and `String.prototype.replace()` with an appropriate regular expression to remove unnecessary characters.
+- Use `String.prototype.split('')`, `Array.prototype.sort()` and `Array.prototype.join('')` on both strings to normalize them, then check if their normalized forms are equal.
```js
const isAnagram = (str1, str2) => {
diff --git a/snippets/isArrayLike.md b/snippets/isArrayLike.md
index 2f9f611fa..597439527 100644
--- a/snippets/isArrayLike.md
+++ b/snippets/isArrayLike.md
@@ -8,7 +8,8 @@ Checks if the provided argument is array-like (i.e. is iterable).
- Check if the provided argument is not `null` and that its `Symbol.iterator` property is a function.
```js
-const isArrayLike = obj => obj != null && typeof obj[Symbol.iterator] === 'function';
+const isArrayLike = obj =>
+ obj != null && typeof obj[Symbol.iterator] === 'function';
```
```js
diff --git a/snippets/isBeforeDate.md b/snippets/isBeforeDate.md
index ead012f3e..88cda15f8 100644
--- a/snippets/isBeforeDate.md
+++ b/snippets/isBeforeDate.md
@@ -3,7 +3,7 @@ title: isBeforeDate
tags: date,beginner
---
-Check if a date is before another date.
+Checks if a date is before another date.
- Use the less than operator (`<`) to check if the first date comes before the second one.
diff --git a/snippets/isBetweenDates.md b/snippets/isBetweenDates.md
index 442ce178e..fd6416522 100644
--- a/snippets/isBetweenDates.md
+++ b/snippets/isBetweenDates.md
@@ -3,15 +3,24 @@ title: isBetweenDates
tags: date,beginner
---
-Check if a date is between two other dates.
+Checks if a date is between two other dates.
- Use the greater than (`>`) and less than (`<`) operators to check if `date` is between `dateStart` and `dateEnd`.
```js
-const isBetweenDates = (dateStart, dateEnd, date) => date > dateStart && date < dateEnd;
+const isBetweenDates = (dateStart, dateEnd, date) =>
+ date > dateStart && date < dateEnd;
```
```js
-isBetweenDates(new Date(2010, 11, 20), new Date(2010, 11, 30), new Date(2010, 11, 19)); // false
-isBetweenDates(new Date(2010, 11, 20), new Date(2010, 11, 30), new Date(2010, 11, 25)); // true
+isBetweenDates(
+ new Date(2010, 11, 20),
+ new Date(2010, 11, 30),
+ new Date(2010, 11, 19)
+); // false
+isBetweenDates(
+ new Date(2010, 11, 20),
+ new Date(2010, 11, 30),
+ new Date(2010, 11, 25)
+); // true
```
diff --git a/snippets/isBrowser.md b/snippets/isBrowser.md
index d6b4c13ae..f355a45aa 100644
--- a/snippets/isBrowser.md
+++ b/snippets/isBrowser.md
@@ -1,6 +1,6 @@
---
title: isBrowser
-tags: browser,intermediate
+tags: browser,node,intermediate
---
Determines if the current runtime environment is a browser so that front-end modules can run on the server (Node) without throwing errors.
diff --git a/snippets/isBrowserTabFocused.md b/snippets/isBrowserTabFocused.md
index 7f90aba17..8f8f70ce0 100644
--- a/snippets/isBrowserTabFocused.md
+++ b/snippets/isBrowserTabFocused.md
@@ -3,9 +3,9 @@ title: isBrowserTabFocused
tags: browser,beginner
---
-Returns `true` if the browser tab of the page is focused, `false` otherwise.
+Checks if the browser tab of the page is focused.
-- Use the `Document.hidden` property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.
+- Use the `Document.hidden` property, introduced by the [Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API) to check if the browser tab of the page is visible or hidden.
```js
const isBrowserTabFocused = () => !document.hidden;
diff --git a/snippets/isContainedIn.md b/snippets/isContainedIn.md
index 2e331bb43..7bea6100f 100644
--- a/snippets/isContainedIn.md
+++ b/snippets/isContainedIn.md
@@ -3,10 +3,11 @@ title: isContainedIn
tags: array,intermediate
---
-Returns `true` if the elements of the first array are contained in the second one regardless of order, `false` otherwise.
+Checks if the elements of the first array are contained in the second one regardless of order.
- Use a `for...of` loop over a `Set` created from the first array.
-- Use `Array.prototype.some()` to check if all distinct values are contained in the second array, use `Array.prototype.filter()` to compare the number of occurrences of each distinct value in both arrays.
+- Use `Array.prototype.some()` to check if all distinct values are contained in the second array.
+- Use `Array.prototype.filter()` to compare the number of occurrences of each distinct value in both arrays.
- Return `false` if the count of any element is greater in the first array than the second one, `true` otherwise.
```js
diff --git a/snippets/isDateValid.md b/snippets/isDateValid.md
index 2ad17c3b1..9965d261f 100644
--- a/snippets/isDateValid.md
+++ b/snippets/isDateValid.md
@@ -3,13 +3,13 @@ title: isDateValid
tags: date,intermediate
---
-Returns `true` if a valid date object can be created from the given values, `false` otherwise.
+Checks if a valid date object can be created from the given values.
- Use the spread operator (`...`) to pass the array of arguments to the `Date` constructor.
- Use `Date.prototype.valueOf()` and `Number.isNaN()` to check if a valid `Date` object can be created from the given values.
```js
-const isDateValid = (...val) => !isNaN(new Date(...val).valueOf());
+const isDateValid = (...val) => !Number.isNaN(new Date(...val).valueOf());
```
```js
diff --git a/snippets/isDeepFrozen.md b/snippets/isDeepFrozen.md
index 0e28657dd..e9e1ee71c 100644
--- a/snippets/isDeepFrozen.md
+++ b/snippets/isDeepFrozen.md
@@ -3,7 +3,7 @@ title: isDeepFrozen
tags: object,recursion,intermediate
---
-Checks if an object is deeply frozen
+Checks if an object is deeply frozen.
- Use recursion.
- Use `Object.isFrozen()` on the given object.
diff --git a/snippets/isDuplexStream.md b/snippets/isDuplexStream.md
index 520be8537..a674e1852 100644
--- a/snippets/isDuplexStream.md
+++ b/snippets/isDuplexStream.md
@@ -5,7 +5,8 @@ tags: node,type,intermediate
Checks if the given argument is a duplex (readable and writable) stream.
-- Check if the value is different from `null`, use `typeof` to check if a value is of type `object` and the `pipe` property is of type `function`.
+- Check if the value is different from `null`.
+- Use `typeof` to check if a value is of type `object` and the `pipe` property is of type `function`.
- Additionally check if the `typeof` the `_read`, `_write` and `_readableState`, `_writableState` properties are `function` and `object` respectively.
```js
diff --git a/snippets/isDuplicates.md b/snippets/isDuplicates.md
index 13f02a823..c8b9eee70 100644
--- a/snippets/isDuplicates.md
+++ b/snippets/isDuplicates.md
@@ -13,6 +13,6 @@ const hasDuplicates = arr => new Set(arr).size !== arr.length;
```
```js
-hasDuplicates([0,1,1,2]); // true
-hasDuplicates([0,1,2,3,]); // false
+hasDuplicates([0, 1, 1, 2]); // true
+hasDuplicates([0, 1, 2, 3]); // false
```
diff --git a/snippets/isEmpty.md b/snippets/isEmpty.md
index 0f619f3d1..08ab18378 100644
--- a/snippets/isEmpty.md
+++ b/snippets/isEmpty.md
@@ -3,7 +3,7 @@ title: isEmpty
tags: type,array,object,string,beginner
---
-Returns true if the a value is an empty object, collection, has no enumerable properties or is any type that is not considered a collection.
+Checks if the a value is an empty object/collection, has no enumerable properties or is any type that is not considered a collection.
- Check if the provided value is `null` or if its `length` is equal to `0`.
diff --git a/snippets/isEven.md b/snippets/isEven.md
index 96fb16cb5..a78459d07 100644
--- a/snippets/isEven.md
+++ b/snippets/isEven.md
@@ -3,7 +3,7 @@ title: isEven
tags: math,beginner
---
-Returns `true` if the given number is even, `false` otherwise.
+Checks if the given number is even.
- Checks whether a number is odd or even using the modulo (`%`) operator.
- Returns `true` if the number is even, `false` if the number is odd.
diff --git a/snippets/isLeapYear.md b/snippets/isLeapYear.md
index 3fa9d8a87..ce8518491 100644
--- a/snippets/isLeapYear.md
+++ b/snippets/isLeapYear.md
@@ -3,9 +3,10 @@ title: isLeapYear
tags: date,beginner
---
-Returns `true` if the given `year` is a leap year, `false` otherwise.
+Checks if the given `year` is a leap year.
-- Use `new Date()`, setting the date to February 29th of the given `year` and use `Date.prototype.getMonth()` to check if the month is equal to `1`.
+- Use `new Date()`, setting the date to February 29th of the given `year`.
+- Use `Date.prototype.getMonth()` to check if the month is equal to `1`.
```js
const isLeapYear = year => new Date(year, 1, 29).getMonth() === 1;
diff --git a/snippets/isNegativeZero.md b/snippets/isNegativeZero.md
index 821374721..55b41fb24 100644
--- a/snippets/isNegativeZero.md
+++ b/snippets/isNegativeZero.md
@@ -1,11 +1,11 @@
---
title: isNegativeZero
-tags: math,beginner
+tags: math,intermediate
---
Checks if the given value is equal to negative zero (`-0`).
-- Checks whether a passed value is equal to `0` and if `1` divided by the value equals `-Infinity`.
+- Check whether a passed value is equal to `0` and if `1` divided by the value equals `-Infinity`.
```js
const isNegativeZero = val => val === 0 && 1 / val === -Infinity;
diff --git a/snippets/isNil.md b/snippets/isNil.md
index d39d6c983..8c629c7ef 100644
--- a/snippets/isNil.md
+++ b/snippets/isNil.md
@@ -3,7 +3,7 @@ title: isNil
tags: type,beginner
---
-Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.
+Checks if the specified value is `null` or `undefined`.
- Use the strict equality operator to check if the value of `val` is equal to `null` or `undefined`.
diff --git a/snippets/isNode.md b/snippets/isNode.md
index c310a43fa..07aff16f4 100644
--- a/snippets/isNode.md
+++ b/snippets/isNode.md
@@ -1,6 +1,6 @@
---
title: isNode
-tags: node,intermediate
+tags: node,browser,intermediate
---
Determines if the current runtime environment is Node.js.
diff --git a/snippets/isNull.md b/snippets/isNull.md
index dfc0eeecd..4de94c744 100644
--- a/snippets/isNull.md
+++ b/snippets/isNull.md
@@ -3,7 +3,7 @@ title: isNull
tags: type,beginner
---
-Returns `true` if the specified value is `null`, `false` otherwise.
+Checks if the specified value is `null`.
- Use the strict equality operator to check if the value of `val` is equal to `null`.
diff --git a/snippets/isObject.md b/snippets/isObject.md
index 7dec4ad57..817e9d401 100644
--- a/snippets/isObject.md
+++ b/snippets/isObject.md
@@ -5,7 +5,7 @@ tags: type,object,beginner
Returns a boolean determining if the passed value is an object or not.
-- Uses the `Object` constructor to create an object wrapper for the given value.
+- Uses the `Object` constructor to create an object wrapper for the given value.
- If the value is `null` or `undefined`, create and return an empty object.
- Οtherwise, return an object of a type that corresponds to the given value.
diff --git a/snippets/isOdd.md b/snippets/isOdd.md
index 47b400137..c47167a8e 100644
--- a/snippets/isOdd.md
+++ b/snippets/isOdd.md
@@ -3,10 +3,10 @@ title: isOdd
tags: math,beginner
---
-Returns `true` if the given number is odd, `false` otherwise.
+Checks if the given number is odd.
-- Checks whether a number is odd or even using the modulo (`%`) operator.
-- Returns `true` if the number is odd, `false` if the number is even.
+- Check whether a number is odd or even using the modulo (`%`) operator.
+- Return `true` if the number is odd, `false` if the number is even.
```js
const isOdd = num => num % 2 === 1;
diff --git a/snippets/isPlainObject.md b/snippets/isPlainObject.md
index 81af39a36..49977f517 100644
--- a/snippets/isPlainObject.md
+++ b/snippets/isPlainObject.md
@@ -5,10 +5,12 @@ tags: type,object,intermediate
Checks if the provided value is an object created by the Object constructor.
-- Check if the provided value is truthy, use `typeof` to check if it is an object and `Object.prototype.constructor` to make sure the constructor is equal to `Object`.
+- Check if the provided value is truthy.
+- Use `typeof` to check if it is an object and `Object.prototype.constructor` to make sure the constructor is equal to `Object`.
```js
-const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object;
+const isPlainObject = val =>
+ !!val && typeof val === 'object' && val.constructor === Object;
```
```js
diff --git a/snippets/isPowerOfTwo.md b/snippets/isPowerOfTwo.md
index d373e4baf..8022ca2ce 100644
--- a/snippets/isPowerOfTwo.md
+++ b/snippets/isPowerOfTwo.md
@@ -3,7 +3,7 @@ title: isPowerOfTwo
tags: math,beginner
---
-Returns `true` if the given number is a power of `2`, `false` otherwise.
+Checks if the given number is a power of `2`.
- Use the bitwise binary AND operator (`&`) to determine if `n` is a power of `2`.
- Additionally, check that `n` is not falsy.
diff --git a/snippets/isPromiseLike.md b/snippets/isPromiseLike.md
index 9c20a5dd1..f03c11a3e 100644
--- a/snippets/isPromiseLike.md
+++ b/snippets/isPromiseLike.md
@@ -3,7 +3,7 @@ title: isPromiseLike
tags: type,function,promise,intermediate
---
-Returns `true` if an object looks like a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), `false` otherwise.
+Checks if an object looks like a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
- Check if the object is not `null`, its `typeof` matches either `object` or `function` and if it has a `.then` property, which is also a `function`.
diff --git a/snippets/isReadableStream.md b/snippets/isReadableStream.md
index 015fb5252..3810a5f10 100644
--- a/snippets/isReadableStream.md
+++ b/snippets/isReadableStream.md
@@ -5,7 +5,8 @@ tags: node,type,intermediate
Checks if the given argument is a readable stream.
-- Check if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
+- Check if the value is different from `null`.
+- Use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
- Additionally check if the `typeof` the `_read` and `_readableState` properties are `function` and `object` respectively.
```js
diff --git a/snippets/isSameDate.md b/snippets/isSameDate.md
index 995443209..4d77e63f3 100644
--- a/snippets/isSameDate.md
+++ b/snippets/isSameDate.md
@@ -3,7 +3,7 @@ title: isSameDate
tags: date,beginner
---
-Check if a date is the same as another date.
+Checks if a date is the same as another date.
- Use `Date.prototype.toISOString()` and strict equality checking (`===`) to check if the first date is the same as the second one.
diff --git a/snippets/isSorted.md b/snippets/isSorted.md
index 347e998df..080f22295 100644
--- a/snippets/isSorted.md
+++ b/snippets/isSorted.md
@@ -3,11 +3,11 @@ title: isSorted
tags: array,intermediate
---
-Returns `1` if a numeric array is sorted in ascending order, `-1` if it is sorted in descending order or `0` if it is not sorted.
+Checks if a numeric array is sorted.
- Calculate the ordering `direction` for the first pair of adjacent array elements.
- Return `0` if the given array is empty, only has one element or the `direction` changes for any pair of adjacent array elements.
-- Use `Math.sign()` to covert the final value of `direction` to `-1` or `1`.
+- Use `Math.sign()` to covert the final value of `direction` to `-1` (descending order) or `1` (ascending order).
```js
const isSorted = arr => {
diff --git a/snippets/isStream.md b/snippets/isStream.md
index bd2f65400..8507a66f0 100644
--- a/snippets/isStream.md
+++ b/snippets/isStream.md
@@ -5,10 +5,12 @@ tags: node,type,intermediate
Checks if the given argument is a stream.
-- Check if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
+- Check if the value is different from `null`.
+- Use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
```js
-const isStream = val => val !== null && typeof val === 'object' && typeof val.pipe === 'function';
+const isStream = val =>
+ val !== null && typeof val === 'object' && typeof val.pipe === 'function';
```
```js
diff --git a/snippets/isString.md b/snippets/isString.md
index 9c7fde1a8..740c67399 100644
--- a/snippets/isString.md
+++ b/snippets/isString.md
@@ -3,7 +3,8 @@ title: isString
tags: type,string,beginner
---
-Checks if the given argument is a string. Only works for string primitives.
+Checks if the given argument is a string.
+Only works for string primitives.
- Use `typeof` to check if a value is classified as a string primitive.
diff --git a/snippets/isTravisCI.md b/snippets/isTravisCI.md
index 448158a17..1b3b2d159 100644
--- a/snippets/isTravisCI.md
+++ b/snippets/isTravisCI.md
@@ -5,7 +5,7 @@ tags: node,intermediate
Checks if the current environment is [Travis CI](https://travis-ci.org/).
-- Checks if the current environment has the `TRAVIS` and `CI` environment variables ([reference](https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)).
+- Check if the current environment has the `TRAVIS` and `CI` environment variables ([reference](https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)).
```js
const isTravisCI = () => 'TRAVIS' in process.env && 'CI' in process.env;
diff --git a/snippets/isUndefined.md b/snippets/isUndefined.md
index 9ebbfbc4f..6e569845f 100644
--- a/snippets/isUndefined.md
+++ b/snippets/isUndefined.md
@@ -3,7 +3,7 @@ title: isUndefined
tags: type,beginner
---
-Returns `true` if the specified value is `undefined`, `false` otherwise.
+Checks if the specified value is `undefined`.
- Use the strict equality operator to check if `val` is equal to `undefined`.
diff --git a/snippets/isWeekday.md b/snippets/isWeekday.md
index b73944301..292bf806e 100644
--- a/snippets/isWeekday.md
+++ b/snippets/isWeekday.md
@@ -3,10 +3,10 @@ title: isWeekday
tags: date,beginner
---
-Results in a boolean representation of a specific date.
+Checks if the given date is a weekday.
-- Pass the specific date object firstly.
-- Use `Date.prototype.getDay()` to check weekday by using a modulo operator and then returning a boolean.
+- Use `Date.prototype.getDay()` to check weekday by using a modulo operator (`%`).
+- Omit the argument, `d`, to use the current date as default.
```js
const isWeekday = (d = new Date()) => d.getDay() % 6 !== 0;
diff --git a/snippets/isWeekend.md b/snippets/isWeekend.md
index 4a89bb6a1..a97053884 100644
--- a/snippets/isWeekend.md
+++ b/snippets/isWeekend.md
@@ -3,15 +3,13 @@ title: isWeekend
tags: date,beginner
---
-Results in a boolean representation of a specific date.
+Checks if the given date is a weekend.
-- Pass the specific date object firstly.
-- Use `Date.prototype.getDay()` to check weekend based on the day being returned as 0 - 6 using a modulo operation then return a boolean.
+- Use `Date.prototype.getDay()` to check weekend by using a modulo operator (`%`).
+- Omit the argument, `d`, to use the current date as default.
```js
-const isWeekend = (d = new Date()) => {
- return d.getDay() % 6 === 0;
-};
+const isWeekend = (d = new Date()) => d.getDay() % 6 === 0;
```
```js
diff --git a/snippets/isWritableStream.md b/snippets/isWritableStream.md
index 8c13ea2a7..61d78320c 100644
--- a/snippets/isWritableStream.md
+++ b/snippets/isWritableStream.md
@@ -5,7 +5,8 @@ tags: node,type,intermediate
Checks if the given argument is a writable stream.
-- Check if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
+- Check if the value is different from `null`.
+- Use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
- Additionally check if the `typeof` the `_write` and `_writableState` properties are `function` and `object` respectively.
```js
diff --git a/snippets/join.md b/snippets/join.md
index 14b70733f..fc0d992db 100644
--- a/snippets/join.md
+++ b/snippets/join.md
@@ -25,7 +25,7 @@ const join = (arr, separator = ',', end = separator) =>
```
```js
-join(['pen', 'pineapple', 'apple', 'pen'], ',', '&'); // "pen,pineapple,apple&pen"
-join(['pen', 'pineapple', 'apple', 'pen'], ','); // "pen,pineapple,apple,pen"
-join(['pen', 'pineapple', 'apple', 'pen']); // "pen,pineapple,apple,pen"
-```
\ No newline at end of file
+join(['pen', 'pineapple', 'apple', 'pen'], ',', '&'); // 'pen,pineapple,apple&pen'
+join(['pen', 'pineapple', 'apple', 'pen'], ','); // 'pen,pineapple,apple,pen'
+join(['pen', 'pineapple', 'apple', 'pen']); // 'pen,pineapple,apple,pen'
+```
diff --git a/snippets/juxt.md b/snippets/juxt.md
index a9e008bf3..66d67e8ac 100644
--- a/snippets/juxt.md
+++ b/snippets/juxt.md
@@ -17,10 +17,9 @@ juxt(
x => x + 1,
x => x - 1,
x => x * 10
-)(1, 2, 3); // [[2,3,4],[0,1,2],[10,20,30]]
-
+)(1, 2, 3); // [[2, 3, 4], [0, 1, 2], [10, 20, 30]]
juxt(
s => s.length,
s => s.split(" ").join("-")
-)("30 seconds of code"); // [[18],['30-seconds-of-code']]
+)("30 seconds of code"); // [[18], ['30-seconds-of-code']]
```
diff --git a/snippets/last.md b/snippets/last.md
index fcbfb068b..32976b5fa 100644
--- a/snippets/last.md
+++ b/snippets/last.md
@@ -5,7 +5,8 @@ tags: array,beginner
Returns the last element in an array.
-- Check if `arr` is truthy and has a `length` property, use `arr.length - 1` to compute the index of the last element of the given array and return it, otherwise return `undefined`.
+- Check if `arr` is truthy and has a `length` property.
+- Use `Array.prototype.length - 1` to compute the index of the last element of the given array and return it, otherwise return `undefined`.
```js
const last = arr => (arr && arr.length ? arr[arr.length - 1] : undefined);
diff --git a/snippets/lcm.md b/snippets/lcm.md
index 71f54ab6c..c519ea84c 100644
--- a/snippets/lcm.md
+++ b/snippets/lcm.md
@@ -1,6 +1,6 @@
---
title: lcm
-tags: math,recursion,beginner
+tags: math,recursion,intermediate
---
Returns the least common multiple of two or more numbers.
diff --git a/snippets/listenOnce.md b/snippets/listenOnce.md
index 22778d2c3..fa62b9bd0 100644
--- a/snippets/listenOnce.md
+++ b/snippets/listenOnce.md
@@ -5,7 +5,8 @@ tags: browser,event,beginner
Adds an event listener to an element that will only run the callback the first time the event is triggered.
-- Use `EventTarget.addEventListener()` to add an event listener to an element, using `{ once: true }` as options to only run the given callback once.
+- Use `EventTarget.addEventListener()` to add an event listener to an element.
+- Use `{ once: true }` as options to only run the given callback once.
```js
const listenOnce = (el, evt, fn) => el.addEventListener(evt, fn, { once: true });
diff --git a/snippets/longestItem.md b/snippets/longestItem.md
index fdb2d9859..2a1f53903 100644
--- a/snippets/longestItem.md
+++ b/snippets/longestItem.md
@@ -4,10 +4,10 @@ tags: array,intermediate
---
Takes any number of iterable objects or objects with a `length` property and returns the longest one.
-If multiple objects have the same length, the first one will be returned.
-Returns `undefined` if no arguments are provided.
- Use `Array.prototype.reduce()`, comparing the `length` of objects to find the longest one.
+- If multiple objects have the same length, the first one will be returned.
+- Returns `undefined` if no arguments are provided.
```js
const longestItem = (...vals) => vals.reduce((a, x) => (x.length > a.length ? x : a));